fix
This commit is contained in:
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -87,7 +87,7 @@ jobs:
|
|||||||
uv pip install --system --no-build-isolation -e ".[dev]" --constraints torch-constraints.txt
|
uv pip install --system --no-build-isolation -e ".[dev]" --constraints torch-constraints.txt
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
python scripts/unsloth_install.py | bash
|
python scripts/unsloth_install.py | bash
|
||||||
python scripts/cutcrossentropy_install.py --uv | bash
|
python scripts/cutcrossentropy_install.py | bash
|
||||||
|
|
||||||
- name: Make sure PyTorch version wasn't clobbered
|
- name: Make sure PyTorch version wasn't clobbered
|
||||||
run: |
|
run: |
|
||||||
@@ -159,10 +159,10 @@ jobs:
|
|||||||
uv pip install --system build
|
uv pip install --system build
|
||||||
python -m build --sdist
|
python -m build --sdist
|
||||||
uv pip install --system dist/*.tar.gz
|
uv pip install --system dist/*.tar.gz
|
||||||
python scripts/unsloth_install.py | sh
|
|
||||||
python scripts/cutcrossentropy_install.py --uv | sh
|
|
||||||
printf "torch==${{ matrix.pytorch_version }}\n" > torch-constraints.txt
|
printf "torch==${{ matrix.pytorch_version }}\n" > torch-constraints.txt
|
||||||
uv pip install --system ".[dev]" --constraints torch-constraints.txt
|
uv pip install --system ".[dev]" --constraints torch-constraints.txt
|
||||||
|
python scripts/unsloth_install.py | sh
|
||||||
|
python scripts/cutcrossentropy_install.py | sh
|
||||||
|
|
||||||
- name: Make sure PyTorch version wasn't clobbered
|
- name: Make sure PyTorch version wasn't clobbered
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -33,20 +33,20 @@ RUN if [ "$NIGHTLY_BUILD" = "true" ] ; then \
|
|||||||
sed -i 's#"datasets[^"]*"#"datasets @ git+https://github.com/huggingface/datasets.git@main"#' pyproject.toml; \
|
sed -i 's#"datasets[^"]*"#"datasets @ git+https://github.com/huggingface/datasets.git@main"#' pyproject.toml; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN uv pip install packaging==23.2 setuptools==75.8.0
|
RUN uv pip install --system packaging==23.2 setuptools==75.8.0
|
||||||
RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \
|
RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \
|
||||||
uv sync --frozen --extra ring-flash-attn --extra optimizers --extra ray $(printf ' --extra %s' "${AXOLOTL_EXTRAS//,/ }") $AXOLOTL_ARGS; \
|
uv sync --frozen --extra ring-flash-attn --extra optimizers --extra ray $(printf ' --extra %s' "${AXOLOTL_EXTRAS//,/ }") $AXOLOTL_ARGS; \
|
||||||
else \
|
else \
|
||||||
uv sync --frozen --extra ring-flash-attn --extra optimizers --extra ray $AXOLOTL_ARGS; \
|
uv sync --frozen --extra ring-flash-attn --extra optimizers --extra ray $AXOLOTL_ARGS; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN uv pip install --no-build-isolation flash-attn $AXOLOTL_ARGS
|
RUN uv pip install --system --no-build-isolation flash-attn $AXOLOTL_ARGS
|
||||||
|
|
||||||
RUN python scripts/unsloth_install.py | sh
|
RUN python scripts/unsloth_install.py | sh
|
||||||
RUN python scripts/cutcrossentropy_install.py | sh
|
RUN python scripts/cutcrossentropy_install.py | sh
|
||||||
|
|
||||||
# So we can test the Docker image
|
# So we can test the Docker image
|
||||||
RUN uv pip install -e ".[dev]"
|
RUN uv pip install --system -e ".[dev]"
|
||||||
|
|
||||||
# fix so that git fetch/pull from remote works
|
# fix so that git fetch/pull from remote works
|
||||||
RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \
|
RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \
|
||||||
|
|||||||
@@ -1,40 +1,22 @@
|
|||||||
"""Emit the install command for the Axolotl cut-cross-entropy fork."""
|
"""Print the pip command to install Axolotl's cut_cross_entropy fork."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import torch
|
import torch
|
||||||
except ImportError as exc: # pragma: no cover - defensive
|
except ImportError as exc: # pragma: no cover
|
||||||
raise ImportError("Install torch via `pip install torch`") from exc
|
raise ImportError("Install torch via `pip install torch`") from exc
|
||||||
|
|
||||||
from packaging.version import Version as V
|
from packaging.version import Version as V
|
||||||
|
|
||||||
USE_UV_FLAG = "--uv" in sys.argv[1:]
|
if V(torch.__version__.split("+")[0]) < V("2.6.0"):
|
||||||
USE_PIP_FLAG = "--pip" in sys.argv[1:]
|
|
||||||
|
|
||||||
if USE_UV_FLAG and USE_PIP_FLAG:
|
|
||||||
raise SystemExit("Specify only one of --uv or --pip")
|
|
||||||
|
|
||||||
if USE_PIP_FLAG:
|
|
||||||
use_uv = False
|
|
||||||
elif USE_UV_FLAG:
|
|
||||||
use_uv = True
|
|
||||||
else:
|
|
||||||
use_uv = shutil.which("uv") is not None
|
|
||||||
|
|
||||||
if V(torch.__version__) < V("2.4.0"):
|
|
||||||
print("")
|
print("")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# No need to uninstall in CI runs; the environment is fresh. Just emit the install command.
|
print(
|
||||||
installer = "uv pip install --system" if use_uv else "pip install"
|
"python -m pip install "
|
||||||
command = (
|
|
||||||
f"{installer} "
|
|
||||||
'"cut-cross-entropy[transformers] '
|
'"cut-cross-entropy[transformers] '
|
||||||
'@ git+https://github.com/axolotl-ai-cloud/ml-cross-entropy.git@147ea28"'
|
'@ git+https://github.com/axolotl-ai-cloud/ml-cross-entropy.git@147ea28"'
|
||||||
)
|
)
|
||||||
|
|
||||||
print(command)
|
|
||||||
|
|||||||
37
scripts/unsloth_install.py
Normal file → Executable file
37
scripts/unsloth_install.py
Normal file → Executable file
@@ -1,7 +1,8 @@
|
|||||||
"""Emit the uv commands needed to install Unsloth without touching torch."""
|
"""Emit the install commands for Unsloth without altering torch."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
|
|
||||||
@@ -14,16 +15,34 @@ from packaging.version import Version as V
|
|||||||
|
|
||||||
MIN_TORCH = V("2.6.0")
|
MIN_TORCH = V("2.6.0")
|
||||||
|
|
||||||
python_version = V(torch.__version__.split("+")[0])
|
if V(torch.__version__.split("+")[0]) < MIN_TORCH:
|
||||||
if python_version < MIN_TORCH:
|
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Torch {torch.__version__} detected, but Unsloth requires >= {MIN_TORCH}."
|
f"Torch {torch.__version__} detected, but Unsloth requires >= {MIN_TORCH}."
|
||||||
)
|
)
|
||||||
|
|
||||||
python_path = quote(sys.executable)
|
USE_UV_FLAG = "--uv" in sys.argv[1:]
|
||||||
commands = (
|
USE_PIP_FLAG = "--pip" in sys.argv[1:]
|
||||||
f"uv pip install --python {python_path} --no-deps unsloth-zoo==2025.9.12 && "
|
|
||||||
f'uv pip install --python {python_path} --no-deps "unsloth[huggingface]==2025.9.9"'
|
|
||||||
)
|
|
||||||
|
|
||||||
print(commands)
|
if USE_UV_FLAG and USE_PIP_FLAG:
|
||||||
|
raise SystemExit("Specify only one of --uv or --pip")
|
||||||
|
|
||||||
|
if USE_PIP_FLAG:
|
||||||
|
use_uv = False
|
||||||
|
elif USE_UV_FLAG:
|
||||||
|
use_uv = True
|
||||||
|
else:
|
||||||
|
use_uv = shutil.which("uv") is not None
|
||||||
|
|
||||||
|
python_exe = quote(sys.executable or shutil.which("python3") or "python")
|
||||||
|
|
||||||
|
if use_uv:
|
||||||
|
installer = "uv pip install --system --no-deps"
|
||||||
|
else:
|
||||||
|
installer = f"{python_exe} -m pip install --no-deps"
|
||||||
|
|
||||||
|
commands = [
|
||||||
|
f"{installer} unsloth-zoo==2025.9.12",
|
||||||
|
f'{installer} "unsloth[huggingface]==2025.9.9"',
|
||||||
|
]
|
||||||
|
|
||||||
|
print(" && ".join(commands))
|
||||||
|
|||||||
Reference in New Issue
Block a user