go uv first

This commit is contained in:
Dan Saunders
2025-08-21 05:05:03 +00:00
parent 740d5a1d31
commit 8e9386c799
6 changed files with 6711 additions and 25 deletions

View File

@@ -74,6 +74,9 @@ jobs:
python-version: ${{ matrix.python_version }} python-version: ${{ matrix.python_version }}
cache: 'pip' # caching pip dependencies cache: 'pip' # caching pip dependencies
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: upgrade pip - name: upgrade pip
run: | run: |
pip3 install --upgrade pip pip3 install --upgrade pip
@@ -81,15 +84,17 @@ jobs:
- name: Install PyTorch - name: Install PyTorch
run: | run: |
pip3 install torch==${{ matrix.pytorch_version }} torchvision source $HOME/.local/bin/env
uv pip install torch==${{ matrix.pytorch_version }} torchvision
- name: Install dependencies - name: Install dependencies
run: | run: |
pip3 show torch source $HOME/.local/bin/env
pip3 install --no-build-isolation -U -e . uv pip show torch
python scripts/unsloth_install.py | sh uv pip install --no-build-isolation -U -e .
python scripts/cutcrossentropy_install.py | sh python scripts/unsloth_install.py --uv | sh
pip3 install -r requirements-dev.txt -r requirements-tests.txt python scripts/cutcrossentropy_install.py --uv | sh
uv pip install -r requirements-dev.txt -r requirements-tests.txt
- name: Make sure PyTorch version wasn't clobbered - name: Make sure PyTorch version wasn't clobbered
run: | run: |
@@ -149,6 +154,9 @@ jobs:
python-version: ${{ matrix.python_version }} python-version: ${{ matrix.python_version }}
cache: 'pip' # caching pip dependencies cache: 'pip' # caching pip dependencies
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: upgrade pip - name: upgrade pip
run: | run: |
pip3 install --upgrade pip pip3 install --upgrade pip
@@ -156,16 +164,18 @@ jobs:
- name: Install PyTorch - name: Install PyTorch
run: | run: |
pip3 install torch==${{ matrix.pytorch_version }} torchvision source $HOME/.local/bin/env
uv pip install torch==${{ matrix.pytorch_version }} torchvision
- name: Install dependencies - name: Install dependencies
run: | run: |
pip3 show torch source $HOME/.local/bin/env
uv pip show torch
python -m build --no-isolation --sdist python -m build --no-isolation --sdist
pip3 install --no-build-isolation dist/axolotl*.tar.gz uv pip install --no-build-isolation dist/axolotl*.tar.gz
python scripts/unsloth_install.py | sh python scripts/unsloth_install.py --uv | sh
python scripts/cutcrossentropy_install.py | sh python scripts/cutcrossentropy_install.py --uv | sh
pip3 install -r requirements-dev.txt -r requirements-tests.txt uv pip install -r requirements-dev.txt -r requirements-tests.txt
- name: Make sure PyTorch version wasn't clobbered - name: Make sure PyTorch version wasn't clobbered
run: | run: |
@@ -257,7 +267,7 @@ jobs:
pip install modal==1.0.2 jinja2 pip install modal==1.0.2 jinja2
- name: Update env vars - name: Update env vars
run: | run: |
echo "BASE_TAG=main-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV echo "BASE_TAG=main-base-uv-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV
echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV
echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV
echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV
@@ -318,7 +328,7 @@ jobs:
pip install modal==1.0.2 jinja2 pip install modal==1.0.2 jinja2
- name: Update env vars - name: Update env vars
run: | run: |
echo "BASE_TAG=main-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV echo "BASE_TAG=main-base-uv-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV
echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV
echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV
echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV
@@ -361,7 +371,7 @@ jobs:
pip install modal==1.0.2 jinja2 pip install modal==1.0.2 jinja2
- name: Update env vars - name: Update env vars
run: | run: |
echo "BASE_TAG=main-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV echo "BASE_TAG=main-base-uv-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}" >> $GITHUB_ENV
echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV echo "PYTORCH_VERSION=${{ matrix.pytorch}}" >> $GITHUB_ENV
echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV echo "AXOLOTL_ARGS=${{ matrix.axolotl_args}}" >> $GITHUB_ENV
echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV echo "AXOLOTL_EXTRAS=${{ matrix.axolotl_extras}}" >> $GITHUB_ENV

View File

@@ -81,6 +81,20 @@ Features:
### Installation ### Installation
#### Using uv (recommended)
```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install axolotl
uv pip install --no-build-isolation axolotl[flash-attn,deepspeed]
# Download example axolotl configs, deepspeed configs
axolotl fetch examples
axolotl fetch deepspeed_configs # OPTIONAL
```
#### Using pip #### Using pip
```bash ```bash

View File

@@ -1,5 +1,5 @@
ARG BASE_TAG=main-base ARG BASE_TAG=main-base-uv
FROM axolotlai/axolotl-base:$BASE_TAG FROM axolotlai/axolotl-base-uv:$BASE_TAG
ARG TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6+PTX" ARG TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6+PTX"
ARG AXOLOTL_EXTRAS="" ARG AXOLOTL_EXTRAS=""
@@ -22,14 +22,13 @@ WORKDIR /workspace/axolotl
# If AXOLOTL_EXTRAS is set, append it in brackets # If AXOLOTL_EXTRAS is set, append it in brackets
RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \ RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \
pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray,$AXOLOTL_EXTRAS] $AXOLOTL_ARGS; \ uv pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray,$AXOLOTL_EXTRAS] $AXOLOTL_ARGS; \
else \ else \
pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray] $AXOLOTL_ARGS; \ uv pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray] $AXOLOTL_ARGS; \
fi && \ fi && \
python scripts/unsloth_install.py | sh && \ python scripts/unsloth_install.py --uv | sh && \
python scripts/cutcrossentropy_install.py | sh && \ python scripts/cutcrossentropy_install.py --uv | sh && \
pip install pytest && \ uv pip install pytest
pip cache purge
# fix so that git fetch/pull from remote works with shallow clone # fix so that git fetch/pull from remote works with shallow clone
RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \ RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \

View File

@@ -29,7 +29,19 @@ Follow the instructions at: [https://pytorch.org/get-started/locally/](https://p
For Blackwell GPUs, please use Pytorch 2.7.0 and CUDA 12.8. For Blackwell GPUs, please use Pytorch 2.7.0 and CUDA 12.8.
::: :::
### PyPI Installation (Recommended) {#sec-pypi} ### uv Installation (Recommended) {#sec-uv-quick}
For a quick installation with uv:
```{.bash}
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install axolotl
uv pip install --no-build-isolation axolotl[flash-attn,deepspeed]
```
### PyPI Installation {#sec-pypi}
```{.bash} ```{.bash}
pip3 install -U packaging setuptools wheel ninja pip3 install -U packaging setuptools wheel ninja
@@ -41,7 +53,7 @@ installed) in order not to clobber it, and so that we set the correct version of
dependencies that are specific to the PyTorch version or other installed dependencies that are specific to the PyTorch version or other installed
co-dependencies. co-dependencies.
### uv Installation {#sec-uv} ### Advanced uv Installation {#sec-uv}
uv is a fast, reliable Python package installer and resolver built in Rust. It offers significant performance improvements over pip and provides better dependency resolution, making it an excellent choice for complex environments. uv is a fast, reliable Python package installer and resolver built in Rust. It offers significant performance improvements over pip and provides better dependency resolution, making it an excellent choice for complex environments.
@@ -79,6 +91,17 @@ uv pip install --no-build-isolation axolotl[deepspeed,flash-attn,vllm]
For the latest features between releases: For the latest features between releases:
#### Using uv (recommended)
```{.bash}
git clone https://github.com/axolotl-ai-cloud/axolotl.git
cd axolotl
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
uv pip install --no-build-isolation -e '.[flash-attn,deepspeed]'
```
#### Using pip
```{.bash} ```{.bash}
git clone https://github.com/axolotl-ai-cloud/axolotl.git git clone https://github.com/axolotl-ai-cloud/axolotl.git
cd axolotl cd axolotl

View File

@@ -2,6 +2,26 @@
requires = ["setuptools>=64", "wheel", "setuptools_scm>=8", "packaging==23.2"] requires = ["setuptools>=64", "wheel", "setuptools_scm>=8", "packaging==23.2"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.uv]
dev-dependencies = [
"pytest",
"pytest-cov",
"pytest-xdist",
"pre-commit",
"ruff",
"mypy",
]
[[tool.uv.index]]
url = "https://huggingface.github.io/autogptq-index/whl/cu118/"
[tool.uv.extra-build-dependencies]
mamba-ssm = ["torch", "causal_conv1d"]
flash-attn = ["torch", "packaging", "wheel", "setuptools"]
autoawq = ["torch"]
triton = ["torch"]
bitsandbytes = ["torch"]
[project] [project]
name = "axolotl" name = "axolotl"
dynamic = ["version", "dependencies", "optional-dependencies"] dynamic = ["version", "dependencies", "optional-dependencies"]

6620
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff