diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fcfd96891..56f19fe57 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,7 +31,11 @@ PRs are **greatly welcome**! Please run below to setup env ```bash -pip3 install -r requirements-dev.txt -r requirements-tests.txt +# Using uv (recommended) +uv pip install -e .[dev] +# OR using pip +pip3 install -e .[dev] + pre-commit install # test diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 79421ff97..3d16e9240 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -47,7 +47,7 @@ jobs: run: | uv pip install --system wheel packaging==23.2 uv pip install --system --no-build-isolation -e . - uv pip install --system -r requirements-dev.txt -r requirements-tests.txt + uv pip install --system -e .[dev] - name: Extract tag name id: tag diff --git a/.github/workflows/tests-nightly.yml b/.github/workflows/tests-nightly.yml index df57fdad8..b1e85cc2a 100644 --- a/.github/workflows/tests-nightly.yml +++ b/.github/workflows/tests-nightly.yml @@ -66,7 +66,7 @@ jobs: uv pip install --system --no-build-isolation -U -e . python scripts/unsloth_install.py --uv | sh python scripts/cutcrossentropy_install.py --uv | sh - uv pip install --system -r requirements-dev.txt -r requirements-tests.txt + uv pip install --system -e .[dev] - name: Make sure PyTorch version wasn't clobbered run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 44afad9a3..a0eccfe81 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,8 +8,8 @@ on: paths: - '**.py' - 'requirements.txt' + - 'pyproject.toml' - '.github/workflows/*.yml' - - 'requirements-tests.txt' - 'cicd/cicd.sh' - 'cicd/Dockerfile.jinja' pull_request: @@ -17,8 +17,8 @@ on: paths: - '**.py' - 'requirements.txt' + - 'pyproject.toml' - '.github/workflows/*.yml' - - 'requirements-tests.txt' - 'cicd/cicd.sh' - 'cicd/Dockerfile.jinja' workflow_dispatch: @@ -87,7 +87,7 @@ jobs: uv pip install --system --no-build-isolation -U -e . python scripts/unsloth_install.py --uv | sh python scripts/cutcrossentropy_install.py --uv | sh - uv pip install --system -r requirements-dev.txt -r requirements-tests.txt + uv pip install --system -e .[dev] - name: Make sure PyTorch version wasn't clobbered run: | @@ -155,10 +155,11 @@ jobs: - name: Install dependencies run: | uv pip show --system torch + uv pip install --system wheel uv pip install --system --no-build-isolation -e . python scripts/unsloth_install.py --uv | sh python scripts/cutcrossentropy_install.py --uv | sh - uv pip install --system -r requirements-dev.txt -r requirements-tests.txt + uv pip install --system -e .[dev] - name: Make sure PyTorch version wasn't clobbered run: | @@ -233,7 +234,7 @@ jobs: pytorch: 2.7.1 num_gpus: 1 axolotl_extras: - dockerfile: "Dockerfile-uv.jinja" + dockerfile: "Dockerfile.jinja" steps: - name: Checkout uses: actions/checkout@v4 diff --git a/cicd/Dockerfile-uv.jinja b/cicd/Dockerfile-uv.jinja deleted file mode 100644 index 860386187..000000000 --- a/cicd/Dockerfile-uv.jinja +++ /dev/null @@ -1,52 +0,0 @@ -FROM axolotlai/axolotl-base-uv:{{ BASE_TAG }} - -ENV TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 9.0+PTX" -ENV AXOLOTL_EXTRAS="{{ AXOLOTL_EXTRAS }}" -ENV AXOLOTL_ARGS="{{ AXOLOTL_ARGS }}" -ENV CUDA="{{ CUDA }}" -ENV PYTORCH_VERSION="{{ PYTORCH_VERSION }}" -ENV GITHUB_REF="{{ GITHUB_REF }}" -ENV GITHUB_SHA="{{ GITHUB_SHA }}" -ENV NIGHTLY_BUILD="{{ NIGHTLY_BUILD }}" -ENV HF_HOME="{{ HF_HOME }}" - -RUN apt-get update && \ - apt-get install -y --allow-change-held-packages vim curl nano libnccl2 libnccl-dev ibverbs-providers ibverbs-utils infiniband-diags librdmacm-dev librdmacm1 rdmacm-utils slurm-wlm - -WORKDIR /workspace - -RUN git clone --depth=1 https://github.com/axolotl-ai-cloud/axolotl.git - -WORKDIR /workspace/axolotl - -RUN git fetch origin +$GITHUB_REF && \ - git checkout FETCH_HEAD - -# If AXOLOTL_EXTRAS is set, append it in brackets -RUN if [ "$NIGHTLY_BUILD" = "true" ] ; then \ - sed -i 's#^transformers.*#transformers @ git+https://github.com/huggingface/transformers.git@main#' requirements.txt; \ - sed -i 's#^peft.*#peft @ git+https://github.com/huggingface/peft.git@main#' requirements.txt; \ - sed -i 's#^accelerate.*#accelerate @ git+https://github.com/huggingface/accelerate.git@main#' requirements.txt; \ - sed -i 's#^trl.*#trl @ git+https://github.com/huggingface/trl.git@main#' requirements.txt; \ - sed -i 's#^datasets.*#datasets @ git+https://github.com/huggingface/datasets.git@main#' requirements.txt; \ - fi - -RUN uv pip install packaging==23.2 setuptools==75.8.0 -RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \ - uv pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray,$AXOLOTL_EXTRAS] $AXOLOTL_ARGS; \ - else \ - uv pip install --no-build-isolation -e .[deepspeed,flash-attn,ring-flash-attn,optimizers,ray] $AXOLOTL_ARGS; \ - fi - -RUN python scripts/unsloth_install.py --uv | sh -RUN python scripts/cutcrossentropy_install.py --uv | sh - -# So we can test the Docker image -RUN uv pip install -r requirements-dev.txt -r requirements-tests.txt - -# fix so that git fetch/pull from remote works -RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \ - git config --get remote.origin.fetch - -# helper for huggingface-login cli -RUN git config --global credential.helper store diff --git a/cicd/Dockerfile.jinja b/cicd/Dockerfile.jinja index 94c9a67e3..9c37c484e 100644 --- a/cicd/Dockerfile.jinja +++ b/cicd/Dockerfile.jinja @@ -1,6 +1,6 @@ -FROM axolotlai/axolotl-base:{{ BASE_TAG }} +FROM axolotlai/axolotl-base-uv:{{ BASE_TAG }} -ENV TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6+PTX" +ENV TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 9.0+PTX" ENV AXOLOTL_EXTRAS="{{ AXOLOTL_EXTRAS }}" ENV AXOLOTL_ARGS="{{ AXOLOTL_ARGS }}" ENV CUDA="{{ CUDA }}" @@ -9,7 +9,6 @@ ENV GITHUB_REF="{{ GITHUB_REF }}" ENV GITHUB_SHA="{{ GITHUB_SHA }}" ENV NIGHTLY_BUILD="{{ NIGHTLY_BUILD }}" ENV HF_HOME="{{ HF_HOME }}" -ENV AXOLOTL_DATASET_PROCESSES="8" RUN apt-get update && \ apt-get install -y --allow-change-held-packages vim curl nano libnccl2 libnccl-dev ibverbs-providers ibverbs-utils infiniband-diags librdmacm-dev librdmacm1 rdmacm-utils slurm-wlm @@ -32,18 +31,18 @@ RUN if [ "$NIGHTLY_BUILD" = "true" ] ; then \ sed -i 's#^datasets.*#datasets @ git+https://github.com/huggingface/datasets.git@main#' requirements.txt; \ fi -RUN pip install packaging==23.2 setuptools==75.8.0 +RUN uv pip install packaging==23.2 setuptools==75.8.0 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 \ - 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 -RUN python scripts/unsloth_install.py | sh -RUN python scripts/cutcrossentropy_install.py | sh +RUN python scripts/unsloth_install.py --uv | sh +RUN python scripts/cutcrossentropy_install.py --uv | sh # So we can test the Docker image -RUN pip install -r requirements-dev.txt -r requirements-tests.txt +RUN uv pip install -e .[dev] # fix so that git fetch/pull from remote works RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \ diff --git a/pyproject.toml b/pyproject.toml index 4f1615767..0807a1cf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -164,12 +164,30 @@ llmcompressor = [ # Development dependencies dev = [ + # Testing "pytest", - "pytest-cov", + "pytest-cov", + "pytest-retry", + "pytest-sugar", "pytest-xdist", - "pre-commit", - "ruff", + "codecov", + "codecov-cli", + "tbparse", + + # Code quality + "black", + "ruff", "mypy", + "pre-commit", + "types-requests", + + # Documentation + "quartodoc", + "jupyter", + + # Utilities + "blobfile", + "tiktoken", ] [project.scripts]