winglian commited on
Commit
2734e3f
1 Parent(s): 14ebd2e

build base separately

Browse files

fix arg order for image
fix dockerfile var excaping
move args around

.github/workflows/base.yml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ci-cd
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main-base"
7
+ - "dev-base"
8
+
9
+ jobs:
10
+ build-base:
11
+ if: github.repository_owner == 'OpenAccess-AI-Collective'
12
+ runs-on: self-hosted
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v3
16
+ - name: Docker metadata
17
+ id: metadata
18
+ uses: docker/metadata-action@v3
19
+ with:
20
+ images: winglian/axolotl-base
21
+ - name: Login to Docker Hub
22
+ uses: docker/login-action@v2
23
+ with:
24
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
25
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
26
+ - name: Set up Docker Buildx
27
+ uses: docker/setup-buildx-action@v2
28
+ - name: Build
29
+ uses: docker/build-push-action@v4
30
+ with:
31
+ context: .
32
+ file: ./docker/Dockerfile-base
33
+ push: ${{ github.event_name != 'pull_request' }}
34
+ tags: ${{ steps.metadata.outputs.tags }}
35
+ labels: ${{ steps.metadata.outputs.labels }}
.github/workflows/main.yml CHANGED
@@ -1,4 +1,4 @@
1
- name: ci
2
 
3
  on:
4
  push:
@@ -7,34 +7,7 @@ on:
7
  - "dev"
8
 
9
  jobs:
10
- build-base:
11
- if: github.repository_owner == 'OpenAccess-AI-Collective'
12
- runs-on: self-hosted
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v3
16
- - name: Docker metadata
17
- id: metadata
18
- uses: docker/metadata-action@v3
19
- with:
20
- images: winglian/axolotl-base
21
- - name: Login to Docker Hub
22
- uses: docker/login-action@v2
23
- with:
24
- username: ${{ secrets.DOCKERHUB_USERNAME }}
25
- password: ${{ secrets.DOCKERHUB_TOKEN }}
26
- - name: Set up Docker Buildx
27
- uses: docker/setup-buildx-action@v2
28
- - name: Build
29
- uses: docker/build-push-action@v4
30
- with:
31
- context: .
32
- file: ./docker/Dockerfile-base
33
- push: ${{ github.event_name != 'pull_request' }}
34
- tags: ${{ steps.metadata.outputs.tags }}
35
- labels: ${{ steps.metadata.outputs.labels }}
36
  build-axolotl:
37
- needs: build-base
38
  if: github.repository_owner == 'OpenAccess-AI-Collective'
39
  runs-on: self-hosted
40
  steps:
 
1
+ name: ci-cd
2
 
3
  on:
4
  push:
 
7
  - "dev"
8
 
9
  jobs:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  build-axolotl:
 
11
  if: github.repository_owner == 'OpenAccess-AI-Collective'
12
  runs-on: self-hosted
13
  steps:
docker/Dockerfile-base CHANGED
@@ -2,11 +2,14 @@ ARG CUDA_VERSION="11.8.0"
2
  ARG CUDNN_VERSION="8"
3
  ARG UBUNTU_VERSION="22.04"
4
 
5
- FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION
6
 
7
  ENV PATH="/root/miniconda3/bin:${PATH}"
8
 
9
  ARG PYTHON_VERSION="3.9"
 
 
 
10
  ENV PYTHON_VERSION=$PYTHON_VERSION
11
 
12
  RUN apt-get update
@@ -23,3 +26,32 @@ RUN conda create -n "py${PYTHON_VERSION}" python="${PYTHON_VERSION}"
23
  ENV PATH="/root/miniconda3/envs/py${PYTHON_VERSION}/bin:${PATH}"
24
 
25
  WORKDIR /workspace
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  ARG CUDNN_VERSION="8"
3
  ARG UBUNTU_VERSION="22.04"
4
 
5
+ FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION as base-builder
6
 
7
  ENV PATH="/root/miniconda3/bin:${PATH}"
8
 
9
  ARG PYTHON_VERSION="3.9"
10
+ ARG PYTORCH="2.0.0"
11
+ ARG CUDA="cu118"
12
+
13
  ENV PYTHON_VERSION=$PYTHON_VERSION
14
 
15
  RUN apt-get update
 
26
  ENV PATH="/root/miniconda3/envs/py${PYTHON_VERSION}/bin:${PATH}"
27
 
28
  WORKDIR /workspace
29
+
30
+ RUN python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA
31
+
32
+
33
+ FROM base-builder AS flash-attn-builder
34
+
35
+ WORKDIR /workspace
36
+
37
+ ARG TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6+PTX"
38
+
39
+ RUN git clone https://github.com/HazyResearch/flash-attention.git && \
40
+ cd flash-attention && \
41
+ python3 setup.py bdist_wheel
42
+
43
+ FROM base-builder AS deepspeed-builder
44
+
45
+ WORKDIR /workspace
46
+
47
+ RUN git clone https://github.com/microsoft/DeepSpeed.git && \
48
+ cd DeepSpeed && \
49
+ MAX_CONCURRENCY=8 DS_BUILD_SPARSE_ATTN=0 DS_BUILD_OPS=1 python3 setup.py bdist_wheel
50
+
51
+ FROM base-builder
52
+
53
+ RUN mkdir /workspace/wheels
54
+ COPY --from=deepspeed-builder /workspace/DeepSpeed/dist/deepspeed-*.whl wheels
55
+ COPY --from=flash-attn-builder /workspace/flash-attention/dist/flash_attn-*.whl wheels
56
+
57
+ RUN pip3 install.sh wheels/deepspeed-*.whl wheels/flash_attn-*.whl