Merge remote-tracking branch 'origin/main' into feature/rag
# Conflicts: # studio/backend/core/inference/llama_cpp.py # studio/backend/routes/__init__.py # studio/backend/routes/inference.py # studio/frontend/package.json # studio/frontend/src/components/assistant-ui/sources.tsx # studio/frontend/src/components/assistant-ui/thread.tsx # studio/frontend/src/features/chat/api/chat-adapter.ts # studio/frontend/src/features/chat/chat-settings-sheet.tsx # studio/frontend/src/features/chat/shared-composer.tsx # studio/frontend/src/features/chat/stores/chat-runtime-store.ts # studio/frontend/src/features/settings/settings-dialog.tsx
This commit is contained in:
commit
9eb0778628
179 changed files with 27646 additions and 2763 deletions
|
|
@ -37,6 +37,19 @@ from backend.utils.wheel_utils import (
|
|||
IS_WINDOWS = sys.platform == "win32"
|
||||
IS_MACOS = sys.platform == "darwin"
|
||||
IS_MAC_INTEL = IS_MACOS and platform.machine() == "x86_64"
|
||||
IS_MAC_ARM = IS_MACOS and platform.machine() == "arm64"
|
||||
IS_LINUX = sys.platform.startswith("linux")
|
||||
# torchcodec ships wheels only for manylinux_2_28_x86_64,
|
||||
# macosx_12_0_arm64, and win_amd64 (visible in the 0.10.0 PyPI page).
|
||||
# Trying to install it on any other host fails the whole
|
||||
# extras-no-deps step. `unsloth studio update` does not have a
|
||||
# --no-torch flag, so on these hosts the audio extras must be
|
||||
# filtered out independent of the NO_TORCH env var.
|
||||
PLATFORM_LACKS_TORCHCODEC_WHEEL = (
|
||||
(IS_LINUX and platform.machine() in {"aarch64", "arm64"})
|
||||
or (IS_WINDOWS and platform.machine().lower() in {"arm64", "aarch64"})
|
||||
or IS_MAC_INTEL
|
||||
)
|
||||
|
||||
# ── ROCm / AMD GPU support ─────────────────────────────────────────────────────
|
||||
# Mapping from detected ROCm (major, minor) to the best PyTorch wheel tag on
|
||||
|
|
@ -423,6 +436,7 @@ def _infer_no_torch() -> bool:
|
|||
|
||||
NO_TORCH = _infer_no_torch()
|
||||
|
||||
|
||||
# -- Verbosity control ----------------------------------------------------------
|
||||
# By default the installer shows a minimal progress bar (one line, in-place).
|
||||
# Set UNSLOTH_VERBOSE=1 in the environment to restore full per-step output:
|
||||
|
|
@ -448,6 +462,11 @@ LOCAL_DD_GITHUB_PLUGIN = (
|
|||
SCRIPT_DIR / "backend" / "plugins" / "data-designer-github-repo-seed"
|
||||
)
|
||||
|
||||
# Apple Silicon: override mlx-vlm/mlx-lm's transformers pin (see overrides file).
|
||||
_MLX_OVERRIDES = SINGLE_ENV / "overrides-darwin-arm64.txt"
|
||||
if IS_MAC_ARM and _MLX_OVERRIDES.is_file():
|
||||
os.environ.setdefault("UV_OVERRIDE", str(_MLX_OVERRIDES))
|
||||
|
||||
# -- Unicode-safe printing ---------------------------------------------
|
||||
# On Windows the default console encoding can be a legacy code page
|
||||
# (e.g. CP1252) that cannot represent Unicode glyphs such as ✅ or ❌.
|
||||
|
|
@ -597,7 +616,14 @@ WINDOWS_SKIP_PACKAGES = {"open_spiel", "triton_kernels"}
|
|||
# Packages to skip when torch is unavailable (Intel Mac GGUF-only mode).
|
||||
# These packages either *are* torch extensions or have unconditional
|
||||
# ``Requires-Dist: torch`` in their published metadata, so installing
|
||||
# them would pull torch back into the environment.
|
||||
# them would pull torch back into the environment. ``librosa`` also
|
||||
# lives in this set even though it does not itself require torch:
|
||||
# upstream ``llvmlite`` dropped its macOS x86_64 wheel between 0.42.0
|
||||
# and 0.46.0+ (see https://pypi.org/project/llvmlite/0.47.0/#files --
|
||||
# only macosx_arm64 / manylinux / win_amd64 remain), so on Intel Mac
|
||||
# the librosa -> numba -> llvmlite chain triggers a from-source build
|
||||
# that fails inside CI and on the host without LLVM 14/15 headers.
|
||||
# Tracked separately in unslothai/unsloth#5046.
|
||||
NO_TORCH_SKIP_PACKAGES = {
|
||||
"torch-stoi",
|
||||
"timm",
|
||||
|
|
@ -605,6 +631,7 @@ NO_TORCH_SKIP_PACKAGES = {
|
|||
"torch-c-dlpack-ext",
|
||||
"openai-whisper",
|
||||
"transformers-cfg",
|
||||
"librosa",
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -832,6 +859,14 @@ def pip_install(
|
|||
if actual_req is not None and NO_TORCH and NO_TORCH_SKIP_PACKAGES:
|
||||
actual_req = _filter_requirements(actual_req, NO_TORCH_SKIP_PACKAGES)
|
||||
temp_reqs.append(actual_req)
|
||||
if actual_req is not None and PLATFORM_LACKS_TORCHCODEC_WHEEL:
|
||||
# Linux aarch64 / Windows ARM64 / Intel Mac have no torchcodec
|
||||
# wheel. `unsloth studio update --local` does not pass
|
||||
# --no-torch, so the NO_TORCH filter above does not fire; do
|
||||
# the targeted skip independently so the audio extras step
|
||||
# does not take down the whole update.
|
||||
actual_req = _filter_requirements(actual_req, {"torchcodec"})
|
||||
temp_reqs.append(actual_req)
|
||||
req_args_pip: list[str] = []
|
||||
req_args_uv: list[str] = []
|
||||
if actual_req is not None:
|
||||
|
|
@ -962,6 +997,20 @@ def install_python_stack() -> int:
|
|||
[sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
|
||||
)
|
||||
|
||||
# macOS arm64: install MLX stack at latest (UV_OVERRIDE relaxes the
|
||||
# mlx-vlm / mlx-lm transformers pin -- set at module load).
|
||||
if IS_MAC_ARM and not skip_base:
|
||||
_progress("MLX stack (Apple Silicon)")
|
||||
pip_install(
|
||||
"Installing MLX stack (mlx + mlx-lm + mlx-vlm)",
|
||||
"--no-cache-dir",
|
||||
"--upgrade",
|
||||
"mlx",
|
||||
"mlx-metal",
|
||||
"mlx-lm",
|
||||
"mlx-vlm",
|
||||
)
|
||||
|
||||
# 3. Core packages: unsloth-zoo + unsloth (or custom package name)
|
||||
if skip_base:
|
||||
pass
|
||||
|
|
@ -981,22 +1030,11 @@ def install_python_stack() -> int:
|
|||
package_name,
|
||||
"unsloth-zoo",
|
||||
)
|
||||
# Pydantic ships its core as a separate compiled wheel
|
||||
# (pydantic-core), and pydantic's ``_ensure_pydantic_core_version``
|
||||
# checks the installed core matches the exact version pinned in
|
||||
# its own metadata. With ``--no-deps`` plus an unpinned
|
||||
# ``pydantic`` / ``pydantic-core`` pair in no-torch-runtime.txt,
|
||||
# pip resolved each to the newest available version and the two
|
||||
# drifted (pydantic 2.13.4 pins pydantic-core==2.46.4 today, but
|
||||
# pydantic-core 2.47.0 was the latest). On a fresh Windows venv
|
||||
# the next ``import pydantic`` raised ``SystemError: ...
|
||||
# incompatible with the current pydantic version``.
|
||||
#
|
||||
# Resolve them WITH deps in a focused pip call so pip picks a
|
||||
# compatible pair. pydantic's own deps are
|
||||
# ``annotated-types``, ``pydantic-core``, ``typing-extensions``,
|
||||
# ``typing-inspection`` -- none of which transitively pull
|
||||
# torch, so this is safe for the no-torch path.
|
||||
# Resolve pydantic WITH deps so pip pins pydantic-core to the
|
||||
# exact version pydantic's metadata declares. Under --no-deps
|
||||
# alone pip picks the latest of each and trips pydantic's
|
||||
# _ensure_pydantic_core_version check. Transitive deps are
|
||||
# torch-free.
|
||||
pip_install(
|
||||
"Installing pydantic (with deps for compatible core)",
|
||||
"--no-cache-dir",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue