Skip to content

Commit bbc5bc5

Browse files
authored
Merge pull request axolotl-ai-cloud#108 from OpenAccess-AI-Collective/docker-gptq
default to qlora support, make gptq specific image
2 parents 4df9da7 + 48612f8 commit bbc5bc5

File tree

7 files changed

+48
-72
lines changed

7 files changed

+48
-72
lines changed

.github/workflows/base.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ jobs:
1414
strategy:
1515
matrix:
1616
include:
17-
- cuda: cu118
17+
- cuda: "118"
1818
cuda_version: 11.8.0
19-
cuda_version_bnb: "118"
20-
pytorch: 2.0.0
21-
- cuda: cu117
19+
axolotl_extras:
20+
- cuda: "117"
2221
cuda_version: 11.7.0
23-
cuda_version_bnb: "117"
2422
pytorch: 1.13.1
23+
axolotl_extras:
24+
- cuda: "118"
25+
cuda_version: 11.8.0
26+
pytorch: 2.0.0
27+
axolotl_extras: gptq
2528
steps:
2629
- name: Checkout
2730
uses: actions/checkout@v3
@@ -43,12 +46,12 @@ jobs:
4346
context: .
4447
file: ./docker/Dockerfile-base
4548
push: ${{ github.event_name != 'pull_request' }}
46-
tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}
49+
tags: ${{ steps.metadata.outputs.tags }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
4750
labels: ${{ steps.metadata.outputs.labels }}
4851
cache-from: type=gha
4952
cache-to: type=gha,mode=max
5053
build-args: |
5154
CUDA_VERSION=${{ matrix.cuda_version }}
52-
CUDA_VERSION_BNB=${{ matrix.cuda_version_bnb }}
5355
CUDA=${{ matrix.cuda }}
5456
PYTORCH_VERSION=${{ matrix.pytorch }}
57+
AXOLOTL_EXTRAS=${{ matrix.axolotl_extras }}

.github/workflows/main.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ jobs:
1616
- cuda: cu118
1717
cuda_version: 11.8.0
1818
pytorch: 2.0.0
19+
axolotl_extras:
20+
- cuda: cu118
21+
cuda_version: 11.8.0
22+
pytorch: 2.0.0
23+
axolotl_extras: gptq
1924
- cuda: cu117
2025
cuda_version: 11.7.0
2126
pytorch: 1.13.1
27+
axolotl_extras:
2228
runs-on: self-hosted
2329
steps:
2430
- name: Checkout
@@ -40,10 +46,10 @@ jobs:
4046
with:
4147
context: .
4248
build-args: |
43-
BASE_TAG=${{ github.ref_name }}-base-${{ matrix.cuda }}-${{ matrix.pytorch }}
49+
BASE_TAG=${{ github.ref_name }}-base-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
4450
file: ./docker/Dockerfile
4551
push: ${{ github.event_name != 'pull_request' }}
46-
tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}
52+
tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
4753
labels: ${{ steps.metadata.outputs.labels }}
4854
cache-from: type=gha
4955
cache-to: type=gha,mode=max
@@ -57,9 +63,15 @@ jobs:
5763
- cuda: cu118
5864
cuda_version: 11.8.0
5965
pytorch: 2.0.0
66+
axolotl_extras:
67+
- cuda: cu118
68+
cuda_version: 11.8.0
69+
pytorch: 2.0.0
70+
axolotl_extras: gptq
6071
- cuda: cu117
6172
cuda_version: 11.7.0
6273
pytorch: 1.13.1
74+
axolotl_extras:
6375
runs-on: self-hosted
6476
steps:
6577
- name: Checkout
@@ -81,10 +93,10 @@ jobs:
8193
with:
8294
context: .
8395
build-args: |
84-
BASE_TAG=${{ github.ref_name }}-${{ matrix.cuda }}-${{ matrix.pytorch }}
96+
BASE_TAG=${{ github.ref_name }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
8597
file: ./docker/Dockerfile-runpod
8698
push: ${{ github.event_name != 'pull_request' }}
87-
tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}
99+
tags: ${{ steps.metadata.outputs.tags }}-${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }}
88100
labels: ${{ steps.metadata.outputs.labels }}
89101
cache-from: type=gha
90102
cache-to: type=gha,mode=max

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
```bash
3333
git clone https://github.com/OpenAccess-AI-Collective/axolotl
3434

35-
pip3 install -e .[int4]
35+
pip3 install -e .
3636

3737
accelerate config
3838

@@ -59,9 +59,9 @@ accelerate launch scripts/finetune.py examples/lora-openllama-3b/config.yml \
5959
1. Install python **3.9**
6060

6161
2. Install python dependencies with ONE of the following:
62-
- `pip3 install -e .[int4]` (recommended)
63-
- `pip3 install -e .[int4_triton]`
64-
- `pip3 install -e .`
62+
- `pip3 install -e .` (recommended, supports QLoRA, no gptq/int4 support)
63+
- `pip3 install -e .[gptq]` (next best if you don't need QLoRA, but want to use gptq)
64+
- `pip3 install -e .[gptq_triton]`
6565

6666
### Dataset
6767

docker/Dockerfile

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,26 @@ ARG BASE_TAG=main-base
22
FROM winglian/axolotl-base:$BASE_TAG
33

44
ARG TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6+PTX"
5+
ARG AXOLOTL_EXTRAS=""
56

67
RUN apt-get update && \
78
apt-get install -y vim curl
89

910
WORKDIR /workspace
1011

11-
# The base image ships with `pydantic==1.8.2` which is not working
12-
RUN python3 -m pip install -U --no-cache-dir pydantic
12+
RUN pip3 install --force-reinstall "peft @ git+https://github.com/huggingface/peft.git@main" \
13+
"accelerate @ git+https://github.com/huggingface/accelerate.git@main" \
14+
"transformers @ git+https://github.com/huggingface/transformers.git@main"
1315

1416
RUN mkdir axolotl
1517
COPY . axolotl/
18+
# If AXOLOTL_EXTRAS is set, append it in brackets
1619
RUN cd axolotl && \
17-
pip install -e .[int4]
20+
if [ "$AXOLOTL_EXTRAS" != "" ] ; then \
21+
pip install -e .[$AXOLOTL_EXTRAS]; \
22+
else \
23+
pip install -e .; \
24+
fi
1825

1926
# helper for huggingface-login cli
2027
RUN git config --global credential.helper store

docker/Dockerfile-base

+6-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ENV PATH="/root/miniconda3/bin:${PATH}"
99

1010
ARG PYTHON_VERSION="3.9"
1111
ARG PYTORCH="2.0.0"
12-
ARG CUDA="cu118"
12+
ARG CUDA="118"
1313

1414
ENV PYTHON_VERSION=$PYTHON_VERSION
1515

@@ -29,7 +29,7 @@ ENV PATH="/root/miniconda3/envs/py${PYTHON_VERSION}/bin:${PATH}"
2929
WORKDIR /workspace
3030

3131
RUN python3 -m pip install --upgrade pip && pip3 install packaging && \
32-
python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA
32+
python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu$CUDA
3333

3434

3535
FROM base-builder AS flash-attn-builder
@@ -61,12 +61,12 @@ RUN git clone https://github.com/microsoft/DeepSpeed.git && \
6161
FROM base-builder AS bnb-builder
6262

6363
WORKDIR /workspace
64-
ARG CUDA_VERSION_BNB="118"
65-
ENV CUDA_VERSION_BNB=$CUDA_VERSION_BNB
64+
ARG CUDA="118"
65+
ENV CUDA=$CUDA
6666

6767
RUN git clone https://github.com/TimDettmers/bitsandbytes.git && \
6868
cd bitsandbytes && \
69-
CUDA_VERSION=$CUDA_VERSION_BNB make cuda11x && \
69+
CUDA_VERSION=$CUDA make cuda11x && \
7070
python setup.py bdist_wheel
7171

7272
FROM base-builder
@@ -93,9 +93,6 @@ COPY --from=flash-attn-builder /workspace/flash-attention/csrc/layer_norm/dist/d
9393
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
9494
RUN cd /workspace/builds/bitsandbytes && python3 setup.py install
9595
RUN git lfs install --skip-repo
96-
RUN pip3 install "peft @ git+https://github.com/huggingface/peft.git@main" \
97-
"accelerate @ git+https://github.com/huggingface/accelerate.git@main" \
98-
"transformers @ git+https://github.com/huggingface/transformers.git@main" && \
99-
pip3 install awscli && \
96+
RUN pip3 install awscli && \
10097
# The base image ships with `pydantic==1.8.2` which is not working
10198
pip3 install -U --no-cache-dir pydantic

scripts/setup-runpod.sh

-43
This file was deleted.

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
packages=find_packages(),
2020
install_requires=install_requires,
2121
extras_require={
22-
"int4": [
22+
"gptq": [
2323
"alpaca_lora_4bit @ git+https://github.com/winglian/alpaca_lora_4bit.git@setup_pip",
2424
],
25-
"int4_triton": [
25+
"gptq_triton": [
2626
"alpaca_lora_4bit[triton] @ git+https://github.com/winglian/alpaca_lora_4bit.git@setup_pip",
2727
],
2828
"extras": [

0 commit comments

Comments
 (0)