mirror of
https://github.com/unslothai/unsloth.git
synced 2026-05-01 21:00:41 +00:00
fix: no-torch install deps without pulling torch transitively (#4650)
Use --no-deps for ALL packages (unsloth, unsloth-zoo, and runtime deps) since the current PyPI metadata for unsloth still declares torch as a hard dependency. Runtime deps (typer, pydantic, safetensors, transformers, etc.) are installed from no-torch-runtime.txt with --no-deps to prevent transitive torch resolution from accelerate, peft, trl, and sentence-transformers. no-torch-runtime.txt now includes unsloth's own direct deps (typer, pydantic, pyyaml, nest-asyncio) since --no-deps skips those too. install.sh installs no-torch-runtime.txt directly (via helper function _find_no_torch_runtime). install.ps1 does the same via Find-NoTorchRuntimeFile. SKIP_STUDIO_BASE stays at 1 to avoid setup.sh fast-path issues. install_python_stack.py NO_TORCH branch does the same for unsloth studio update, using package_name instead of hardcoded "unsloth".
This commit is contained in:
parent
a7c43bc46d
commit
eacaf6827c
4 changed files with 85 additions and 26 deletions
|
|
@ -462,13 +462,25 @@ def install_python_stack() -> int:
|
|||
if skip_base:
|
||||
print(_green(f"✅ {package_name} already installed — skipping base packages"))
|
||||
elif NO_TORCH:
|
||||
# No-torch mode: unsloth + unsloth-zoo are already installed with
|
||||
# --no-deps by install.sh/install.ps1. Install the runtime deps
|
||||
# (safetensors, transformers, datasets, etc.) from no-torch-runtime.txt.
|
||||
# No-torch update path: install unsloth + unsloth-zoo with --no-deps
|
||||
# (current PyPI metadata still declares torch as a hard dep), then
|
||||
# runtime deps with --no-deps (avoids transitive torch).
|
||||
_progress("base packages (no torch)")
|
||||
pip_install(
|
||||
f"Updating {package_name} + unsloth-zoo (no-torch mode)",
|
||||
"--no-cache-dir",
|
||||
"--no-deps",
|
||||
"--upgrade-package",
|
||||
package_name,
|
||||
"--upgrade-package",
|
||||
"unsloth-zoo",
|
||||
package_name,
|
||||
"unsloth-zoo",
|
||||
)
|
||||
pip_install(
|
||||
"Installing no-torch runtime deps",
|
||||
"--no-cache-dir",
|
||||
"--no-deps",
|
||||
req = REQ_ROOT / "no-torch-runtime.txt",
|
||||
)
|
||||
if local_repo:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue