diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 2b1d99784..6078b2bae 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -14,26 +14,17 @@ jobs: strategy: matrix: include: - - cuda: cu118 + - cuda: "118" cuda_version: 11.8.0 - cuda_version_bnb: "118" - pytorch: 2.0.0 axolotl_extras: - - cuda: cu117 + - cuda: "117" cuda_version: 11.7.0 - cuda_version_bnb: "117" pytorch: 1.13.1 axolotl_extras: - - cuda: cu118 + - cuda: "118" cuda_version: 11.8.0 - cuda_version_bnb: "118" pytorch: 2.0.0 axolotl_extras: gptq - - cuda: cu117 - cuda_version: 11.7.0 - cuda_version_bnb: "117" - pytorch: 1.13.1 - axolotl_extras: gptq steps: - name: Checkout uses: actions/checkout@v3 @@ -55,13 +46,12 @@ jobs: context: . file: ./docker/Dockerfile-base push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} + tags: ${{ steps.metadata.outputs.tags }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} labels: ${{ steps.metadata.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | CUDA_VERSION=${{ matrix.cuda_version }} - CUDA_VERSION_BNB=${{ matrix.cuda_version_bnb }} CUDA=${{ matrix.cuda }} PYTORCH_VERSION=${{ matrix.pytorch }} AXOLOTL_EXTRAS=${{ matrix.axolotl_extras }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e51fef3c..8abb9beda 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,9 +16,15 @@ jobs: - cuda: cu118 cuda_version: 11.8.0 pytorch: 2.0.0 + axolotl_extras: + - cuda: cu118 + cuda_version: 11.8.0 + pytorch: 2.0.0 + axolotl_extras: gptq - cuda: cu117 cuda_version: 11.7.0 pytorch: 1.13.1 + axolotl_extras: runs-on: self-hosted steps: - name: Checkout @@ -40,10 +46,10 @@ jobs: with: context: . build-args: | - BASE_TAG=${{ github.ref_name }}-base-${{ matrix.cuda }}-${{ matrix.pytorch }} + BASE_TAG=${{ github.ref_name }}-base-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} file: ./docker/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }} + tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} labels: ${{ steps.metadata.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max @@ -57,9 +63,15 @@ jobs: - cuda: cu118 cuda_version: 11.8.0 pytorch: 2.0.0 + axolotl_extras: + - cuda: cu118 + cuda_version: 11.8.0 + pytorch: 2.0.0 + axolotl_extras: gptq - cuda: cu117 cuda_version: 11.7.0 pytorch: 1.13.1 + axolotl_extras: runs-on: self-hosted steps: - name: Checkout @@ -81,10 +93,10 @@ jobs: with: context: . build-args: | - BASE_TAG=${{ github.ref_name }}-${{ matrix.cuda }}-${{ matrix.pytorch }} + BASE_TAG=${{ github.ref_name }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} file: ./docker/Dockerfile-runpod push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }} + tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} labels: ${{ steps.metadata.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 1470aae4b..6547ea6eb 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ ```bash git clone https://github.com/OpenAccess-AI-Collective/axolotl -pip3 install -e .[gptq] +pip3 install -e . accelerate config @@ -57,9 +57,9 @@ accelerate launch scripts/finetune.py examples/lora-openllama-3b/config.yml \ 1. Install python **3.9** 2. Install python dependencies with ONE of the following: - - `pip3 install -e .` (recommended, supports qlora, no gptq/int4 support) + - `pip3 install -e .` (recommended, supports QLoRA, no gptq/int4 support) + - `pip3 install -e .[gptq]` (next best if you don't need QLoRA, but want to use gptq) - `pip3 install -e .[gptq_triton]` - - `pip3 install -e .[gptq]` ### Dataset diff --git a/docker/Dockerfile b/docker/Dockerfile index 2f11ab772..cd9b8a302 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,8 +9,9 @@ RUN apt-get update && \ WORKDIR /workspace -# The base image ships with `pydantic==1.8.2` which is not working -RUN python3 -m pip install -U --no-cache-dir pydantic +RUN pip3 install --force-reinstall "peft @ git+https://github.com/huggingface/peft.git@main" \ + "accelerate @ git+https://github.com/huggingface/accelerate.git@main" \ + "transformers @ git+https://github.com/huggingface/transformers.git@main" RUN mkdir axolotl COPY . axolotl/ diff --git a/docker/Dockerfile-base b/docker/Dockerfile-base index a61f6d42d..f9e94f058 100644 --- a/docker/Dockerfile-base +++ b/docker/Dockerfile-base @@ -9,7 +9,7 @@ ENV PATH="/root/miniconda3/bin:${PATH}" ARG PYTHON_VERSION="3.9" ARG PYTORCH="2.0.0" -ARG CUDA="cu118" +ARG CUDA="118" ENV PYTHON_VERSION=$PYTHON_VERSION @@ -29,7 +29,7 @@ ENV PATH="/root/miniconda3/envs/py${PYTHON_VERSION}/bin:${PATH}" WORKDIR /workspace RUN python3 -m pip install --upgrade pip && pip3 install packaging && \ - python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA + python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu$CUDA FROM base-builder AS flash-attn-builder @@ -61,12 +61,12 @@ RUN git clone https://github.com/microsoft/DeepSpeed.git && \ FROM base-builder AS bnb-builder WORKDIR /workspace -ARG CUDA_VERSION_BNB="118" -ENV CUDA_VERSION_BNB=$CUDA_VERSION_BNB +ARG CUDA="118" +ENV CUDA=$CUDA RUN git clone https://github.com/TimDettmers/bitsandbytes.git && \ cd bitsandbytes && \ - CUDA_VERSION=$CUDA_VERSION_BNB make cuda11x && \ + CUDA_VERSION=$CUDA make cuda11x && \ python setup.py bdist_wheel FROM base-builder @@ -93,10 +93,7 @@ COPY --from=flash-attn-builder /workspace/flash-attention/csrc/layer_norm/dist/d RUN pip3 install wheels/deepspeed-*.whl wheels/flash_attn-*.whl wheels/fused_dense_lib-*.whl wheels/xentropy_cuda_lib-*.whl wheels/rotary_emb-*.whl wheels/dropout_layer_norm-*.whl RUN cd /workspace/builds/bitsandbytes && python3 setup.py install RUN git lfs install --skip-repo -RUN pip3 install "peft @ git+https://github.com/huggingface/peft.git@main" \ - "accelerate @ git+https://github.com/huggingface/accelerate.git@main" \ - "transformers @ git+https://github.com/huggingface/transformers.git@main" && \ - pip3 install awscli && \ +RUN pip3 install awscli && \ # The base image ships with `pydantic==1.8.2` which is not working pip3 install -U --no-cache-dir pydantic