-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (132 loc) · 3.99 KB
/
build-ngc-xformers.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: xformers for NGC
run-name: xformers via ${{ github.event_name }}
on:
push:
branches:
- "main"
- "release"
paths:
- ".github/workflows/build-ngc-xformers.yaml"
- "docker/xformers/*"
- "docker-bake.xformers.hcl"
- "docker-bake.ngc.hcl"
- "!**.md"
workflow_dispatch:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
workflow_call:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
pull_request:
paths:
- ".github/workflows/build-ngc-xformers.yaml"
- "docker/xformers/*"
- "docker-bake.xformers.hcl"
- "docker-bake.ngc.hcl"
- "!**.md"
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-xformers
cancel-in-progress: true
env:
IMAGE_NAME: xformers
IMAGE_REGISTRY: ghcr.io
IMAGE_NAMESPACE: ${{ github.repository }}
IMAGE_PLATFORMS: "linux/amd64"
BAKEFILE_NAME: docker-bake.xformers.hcl
# sorry pascal/volta users but GH only lets me compile for 6 hours
TORCH_CUDA_ARCH_LIST: "7.5;8.0;8.6;8.9;9.0"
# for ninja so the runner doesn't explode
MAX_JOBS: 1
# NVCC my behated
NVCC_THREADS: 1
jobs:
build:
name: NGC
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- target: "xformers-v0021-ngc2308"
ngc-ver: "23.08"
xformers-ver: "v0.0.21"
- target: "xformers-v0021-ngc2307"
ngc-ver: "23.07"
xformers-ver: "v0.0.21"
- target: "xformers-dev-ngc2308"
ngc-ver: "23.08"
xformers-ver: "dev"
- target: "xformers-dev-ngc2307"
ngc-ver: "23.07"
xformers-ver: "dev"
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Print bakefile before metadata-action
run: docker buildx bake -f ./${{ env.BAKEFILE_NAME }} --print
- name: Generate docker tags
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
suffix=-${{ matrix.xformers-ver }}-ngc${{ matrix.ngc-ver }}
images: |
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ matrix.xformers-ver }},enable={{is_default_branch}},suffix=-ngc${{ matrix.ngc-ver }}
type=sha,format=short
type=ref,event=tag
type=ref,event=pr
labels: |
org.opencontainers.image.title=xformers-ngc
org.opencontainers.image.description=xformers wheel for NGC pytorch containers
org.opencontainers.image.vendor=neggles.dev
- name: Free disk space
id: free-disk-space
run: |
df -h .
sudo find "$AGENT_TOOLSDIRECTORY" -delete
sudo find /usr/share/dotnet -delete
sudo find /usr/local/lib/android -delete
df -h .
- name: Build & Push Image
id: build-push
uses: docker/bake-action@v3
with:
targets: ${{ matrix.target }}
files: |
./${{ env.BAKEFILE_NAME }}
${{ steps.meta.outputs.bake-file }}
push: ${{ contains(fromJSON('["push", "schedule"]'), github.event_name) || inputs.force-push }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=min