Merge branch 'main' into pip

This commit is contained in:
Daniel Han 2026-03-27 08:42:05 -07:00
commit 7437af2e44
4 changed files with 42 additions and 16 deletions

View file

@ -681,13 +681,13 @@ shell.Run cmd, 0, False
if ($SkipTorch) {
# No-torch: install unsloth + unsloth-zoo with --no-deps, then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.14" unsloth-zoo
uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.16" unsloth-zoo
$NoTorchReq = Find-NoTorchRuntimeFile
if ($NoTorchReq) {
uv pip install --python $VenvPython --no-deps -r $NoTorchReq
}
} else {
uv pip install --python $VenvPython --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.14" unsloth-zoo
uv pip install --python $VenvPython --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.3.16" unsloth-zoo
}
if ($StudioLocalInstall) {
Write-Host "==> Overlaying local repo (editable)..."
@ -709,7 +709,7 @@ shell.Run cmd, 0, False
if ($SkipTorch) {
# No-torch: install unsloth + unsloth-zoo with --no-deps, then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
uv pip install --python $VenvPython --no-deps --upgrade-package unsloth --upgrade-package unsloth-zoo "unsloth>=2026.3.14" unsloth-zoo
uv pip install --python $VenvPython --no-deps --upgrade-package unsloth --upgrade-package unsloth-zoo "unsloth>=2026.3.16" unsloth-zoo
$NoTorchReq = Find-NoTorchRuntimeFile
if ($NoTorchReq) {
uv pip install --python $VenvPython --no-deps -r $NoTorchReq
@ -719,7 +719,7 @@ shell.Run cmd, 0, False
uv pip install --python $VenvPython -e $RepoRoot --no-deps
}
} elseif ($StudioLocalInstall) {
uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.3.14" unsloth-zoo
uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.3.16" unsloth-zoo
Write-Host "==> Overlaying local repo (editable)..."
uv pip install --python $VenvPython -e $RepoRoot --no-deps
} else {
@ -729,7 +729,7 @@ shell.Run cmd, 0, False
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
Write-Host "==> Installing unsloth (this may take a few minutes)..."
if ($StudioLocalInstall) {
uv pip install --python $VenvPython unsloth-zoo "unsloth>=2026.3.14" --torch-backend=auto
uv pip install --python $VenvPython unsloth-zoo "unsloth>=2026.3.16" --torch-backend=auto
Write-Host "==> Overlaying local repo (editable)..."
uv pip install --python $VenvPython -e $RepoRoot --no-deps
} else {

View file

@ -968,7 +968,7 @@ if [ "$_MIGRATED" = true ]; then
# to prevent transitive torch resolution.
uv pip install --python "$_VENV_PY" --no-deps \
--reinstall-package unsloth --reinstall-package unsloth-zoo \
"unsloth>=2026.3.14" unsloth-zoo
"unsloth>=2026.3.16" unsloth-zoo
_NO_TORCH_RT="$(_find_no_torch_runtime)"
if [ -n "$_NO_TORCH_RT" ]; then
uv pip install --python "$_VENV_PY" --no-deps -r "$_NO_TORCH_RT"
@ -976,7 +976,7 @@ if [ "$_MIGRATED" = true ]; then
else
uv pip install --python "$_VENV_PY" \
--reinstall-package unsloth --reinstall-package unsloth-zoo \
"unsloth>=2026.3.14" unsloth-zoo
"unsloth>=2026.3.16" unsloth-zoo
fi
if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
echo "==> Overlaying local repo (editable)..."
@ -998,7 +998,7 @@ elif [ -n "$TORCH_INDEX_URL" ]; then
# runtime deps (typer, safetensors, transformers, etc.) with --no-deps.
uv pip install --python "$_VENV_PY" --no-deps \
--upgrade-package unsloth --upgrade-package unsloth-zoo \
"unsloth>=2026.3.14" unsloth-zoo
"unsloth>=2026.3.16" unsloth-zoo
_NO_TORCH_RT="$(_find_no_torch_runtime)"
if [ -n "$_NO_TORCH_RT" ]; then
uv pip install --python "$_VENV_PY" --no-deps -r "$_NO_TORCH_RT"
@ -1009,7 +1009,7 @@ elif [ -n "$TORCH_INDEX_URL" ]; then
fi
elif [ "$STUDIO_LOCAL_INSTALL" = true ]; then
uv pip install --python "$_VENV_PY" \
--upgrade-package unsloth "unsloth>=2026.3.14" unsloth-zoo
--upgrade-package unsloth "unsloth>=2026.3.16" unsloth-zoo
echo "==> Overlaying local repo (editable)..."
uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps
else
@ -1020,7 +1020,7 @@ else
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
echo "==> Installing unsloth (this may take a few minutes)..."
if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.3.14" --torch-backend=auto
uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.3.16" --torch-backend=auto
echo "==> Overlaying local repo (editable)..."
uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps
else

View file

@ -6,6 +6,7 @@ Path utilities for model and dataset handling
"""
import os
import sys
from pathlib import Path
from typing import Optional
import structlog
@ -14,12 +15,33 @@ from loggers import get_logger
logger = get_logger(__name__)
def _is_wsl() -> bool:
"""Detect if we are running inside WSL (Windows Subsystem for Linux)."""
if sys.platform == "win32":
return False
try:
with open("/proc/version", "r") as f:
return "microsoft" in f.read().lower()
except Exception:
return False
_IS_WSL: bool = _is_wsl()
def normalize_path(path: str) -> str:
"""
Convert Windows paths to WSL format if needed.
Normalize filesystem paths for cross-platform use.
Examples:
On WSL, converts Windows drive-letter paths to ``/mnt/<drive>/...``.
On native Windows, keeps the drive letter and normalizes separators.
On Linux/macOS (non-WSL), paths are returned with forward slashes.
Examples (WSL):
C:\\Users\\... -> /mnt/c/Users/...
Examples (native Windows):
C:\\Users\\... -> C:/Users/...
Examples (Linux/macOS):
/home/user/... -> /home/user/... (unchanged)
"""
if not path:
@ -27,9 +49,13 @@ def normalize_path(path: str) -> str:
# Handle Windows drive letters (C:\\ or c:\\)
if len(path) >= 3 and path[1] == ":" and path[2] in ("\\", "/"):
drive = path[0].lower()
rest = path[3:].replace("\\", "/")
return f"/mnt/{drive}/{rest}"
# Only map to /mnt/<drive>/ when running under WSL;
# on native Windows the drive letter must be preserved.
if _IS_WSL:
drive = path[0].lower()
rest = path[3:].replace("\\", "/")
return f"/mnt/{drive}/{rest}"
return path.replace("\\", "/")
# Already Unix-style or relative
return path.replace("\\", "/")

View file

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "2026.3.16"
__version__ = "2026.3.17"
__all__ = [
"SUPPORTS_BFLOAT16",