add Docker support: skip venv, install only missing deps
This commit is contained in:
parent
e04ea3347e
commit
80706f1f85
3 changed files with 190 additions and 52 deletions
|
|
@ -1421,9 +1421,9 @@ def install_python_stack() -> int:
|
|||
)
|
||||
_TOTAL = (base_total - 1) if skip_base else base_total
|
||||
|
||||
# 1. Try to use uv for faster installs (must happen before pip upgrade
|
||||
# because uv venvs don't include pip by default)
|
||||
USE_UV = _bootstrap_uv()
|
||||
# # 1. Try to use uv for faster installs (must happen before pip upgrade
|
||||
# # because uv venvs don't include pip by default)
|
||||
# USE_UV = _bootstrap_uv()
|
||||
|
||||
# 2. Ensure pip is available (uv venvs created by install.sh don't include pip)
|
||||
_progress("pip bootstrap")
|
||||
|
|
@ -1452,17 +1452,115 @@ def install_python_stack() -> int:
|
|||
).returncode
|
||||
== 0
|
||||
)
|
||||
# # 2. Ensure pip is available (uv venvs created by install.sh don't include pip)
|
||||
# _progress("pip bootstrap")
|
||||
# if USE_UV:
|
||||
# run(
|
||||
# "Bootstrapping pip via uv",
|
||||
# [
|
||||
# "uv",
|
||||
# "pip",
|
||||
# "install",
|
||||
# "--python",
|
||||
# sys.executable,
|
||||
# "pip",
|
||||
# ],
|
||||
# )
|
||||
# else:
|
||||
# # pip may not exist yet (uv-created venvs omit it). Try ensurepip
|
||||
# # first, then upgrade. Only fall back to a direct upgrade when pip
|
||||
# # is already present.
|
||||
# _has_pip = (
|
||||
# subprocess.run(
|
||||
# [sys.executable, "-m", "pip", "--version"],
|
||||
# stdout = subprocess.DEVNULL,
|
||||
# stderr = subprocess.DEVNULL,
|
||||
# ).returncode
|
||||
# == 0
|
||||
# )
|
||||
#
|
||||
# if not _has_pip:
|
||||
# run(
|
||||
# "Bootstrapping pip via ensurepip",
|
||||
# [sys.executable, "-m", "ensurepip", "--upgrade"],
|
||||
# )
|
||||
# else:
|
||||
# run(
|
||||
# "Upgrading pip",
|
||||
# [sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
|
||||
# )
|
||||
|
||||
if not _has_pip:
|
||||
run(
|
||||
"Bootstrapping pip via ensurepip",
|
||||
[sys.executable, "-m", "ensurepip", "--upgrade"],
|
||||
)
|
||||
else:
|
||||
run(
|
||||
"Upgrading pip",
|
||||
[sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
|
||||
)
|
||||
# # 3. Core packages: unsloth-zoo + unsloth (or custom package name)
|
||||
# if skip_base:
|
||||
# print(_green(f"✅ {package_name} already installed — skipping base packages"))
|
||||
# elif NO_TORCH:
|
||||
# # 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:
|
||||
# pip_install(
|
||||
# "Overlaying local repo (editable)",
|
||||
# "--no-cache-dir",
|
||||
# "--no-deps",
|
||||
# "-e",
|
||||
# local_repo,
|
||||
# constrain = False,
|
||||
# )
|
||||
# elif local_repo:
|
||||
# _progress("base packages")
|
||||
# pip_install(
|
||||
# "Updating base packages",
|
||||
# "--no-cache-dir",
|
||||
# "--upgrade-package",
|
||||
# "unsloth",
|
||||
# "--upgrade-package",
|
||||
# "unsloth-zoo",
|
||||
# req = REQ_ROOT / "base.txt",
|
||||
# )
|
||||
# pip_install(
|
||||
# "Overlaying local repo (editable)",
|
||||
# "--no-cache-dir",
|
||||
# "--no-deps",
|
||||
# "-e",
|
||||
# local_repo,
|
||||
# constrain = False,
|
||||
# )
|
||||
# elif package_name != "unsloth":
|
||||
# _progress("base packages")
|
||||
# pip_install(
|
||||
# f"Installing {package_name}",
|
||||
# "--no-cache-dir",
|
||||
# package_name,
|
||||
# )
|
||||
# else:
|
||||
# _progress("base packages")
|
||||
# pip_install(
|
||||
# "Updating base packages",
|
||||
# "--no-cache-dir",
|
||||
# "--upgrade-package",
|
||||
# "unsloth",
|
||||
# "--upgrade-package",
|
||||
# "unsloth-zoo",
|
||||
# req = REQ_ROOT / "base.txt",
|
||||
# )
|
||||
|
||||
# macOS arm64: install MLX stack at latest (UV_OVERRIDE relaxes the
|
||||
# mlx-vlm / mlx-lm transformers pin -- set at module load).
|
||||
|
|
@ -1586,6 +1684,11 @@ def install_python_stack() -> int:
|
|||
"unsloth-zoo",
|
||||
req = REQ_ROOT / "base.txt",
|
||||
)
|
||||
# pip_install(
|
||||
# "Installing additional unsloth dependencies",
|
||||
# "--no-cache-dir",
|
||||
# req = REQ_ROOT / "extras.txt",
|
||||
# )
|
||||
|
||||
# 2b. AMD ROCm: reinstall torch with HIP wheels if the host has ROCm but the
|
||||
# venv received CPU-only torch (common when pip resolves torch from PyPI).
|
||||
|
|
@ -1683,6 +1786,33 @@ def install_python_stack() -> int:
|
|||
req = REQ_ROOT / "triton-kernels.txt",
|
||||
constrain = False,
|
||||
)
|
||||
# pip_install(
|
||||
# "Installing extras (no-deps)",
|
||||
# "--no-deps",
|
||||
# "--no-cache-dir",
|
||||
# req = REQ_ROOT / "extras-no-deps.txt",
|
||||
# )
|
||||
|
||||
# # 4. Overrides (torchao, transformers) -- force-reinstall
|
||||
# _progress("dependency overrides")
|
||||
# pip_install(
|
||||
# "Installing dependency overrides",
|
||||
# "--force-reinstall",
|
||||
# "--no-cache-dir",
|
||||
# req = REQ_ROOT / "overrides.txt",
|
||||
# )
|
||||
|
||||
# # 5. Triton kernels (no-deps, from source)
|
||||
# # Skip on Windows (no support) and macOS (no support).
|
||||
# if not IS_WINDOWS and not IS_MACOS:
|
||||
# _progress("triton kernels")
|
||||
# pip_install(
|
||||
# "Installing triton kernels",
|
||||
# "--no-deps",
|
||||
# "--no-cache-dir",
|
||||
# req = REQ_ROOT / "triton-kernels.txt",
|
||||
# constrain = False,
|
||||
# )
|
||||
|
||||
if not IS_WINDOWS and not IS_MACOS and not NO_TORCH:
|
||||
_progress("flash-attn")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue