fix: use unsloth[huggingfacenotorch] instead of --no-deps in no-torch mode (#4647)

The previous --no-deps approach skipped ALL dependencies, not just
torch. This left safetensors, transformers, datasets, accelerate, etc.
missing, causing PackageNotFoundError at runtime.

Fix: in no-torch mode, install unsloth[huggingfacenotorch] (which pulls
all runtime deps except torch), then install unsloth-zoo with --no-deps
(since zoo's published metadata still declares torch as a hard dep).
This gives a working no-torch environment with all non-torch packages.

Applied to all three installer files: install.sh, install.ps1, and
studio/install_python_stack.py.
This commit is contained in:
Daniel Han 2026-03-27 02:38:11 -07:00 committed by GitHub
commit 3c9f0ed149
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 21 deletions

View file

@ -440,17 +440,24 @@ def install_python_stack() -> int:
if skip_base:
print(_green(f"{package_name} already installed — skipping base packages"))
elif NO_TORCH:
# No-torch mode: install unsloth + unsloth-zoo without torch deps
# No-torch mode: install runtime deps via [huggingfacenotorch] extras
# (safetensors, transformers, datasets, etc.), then unsloth-zoo with
# --no-deps to avoid pulling torch.
_progress("base packages (no torch)")
pip_install(
"Updating base packages (no-torch mode)",
"Installing unsloth runtime deps (no-torch mode)",
"--no-cache-dir",
"--upgrade-package",
"unsloth",
"unsloth[huggingfacenotorch]>=2026.3.14",
)
pip_install(
"Installing unsloth-zoo (no-torch mode)",
"--no-cache-dir",
"--no-deps",
"--upgrade-package",
"unsloth",
"--upgrade-package",
"unsloth-zoo",
req = REQ_ROOT / "base.txt",
"unsloth-zoo",
)
if local_repo:
pip_install(