Skip to content

Commit a98dc75

Browse files
committed
Merge branch 'main' into image_classification_notebook
2 parents 4a9ec7c + d234beb commit a98dc75

17 files changed

+3643
-1905
lines changed

.github/workflows/docker-build.yml

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
arch: [amd64, arm64]
32+
variant: [cpu, cuda]
3233
fail-fast: false
3334
steps:
3435
- name: Checkout code
@@ -54,10 +55,10 @@ jobs:
5455
with:
5556
images: ghcr.io/${{ github.repository }}
5657
tags: |
57-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
58-
type=ref,event=pr
59-
type=ref,event=tag
60-
type=sha,format=short
58+
type=raw,value=${{ matrix.variant }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
59+
type=raw,value=${{ matrix.variant }}-${{ matrix.arch }}-pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }}
60+
type=raw,value=${{ matrix.variant }}-${{ matrix.arch }}-${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
61+
type=raw,value=${{ matrix.variant }}-${{ matrix.arch }}-sha-${{ github.sha }}
6162
6263
- name: Build and push
6364
uses: docker/build-push-action@v6
@@ -66,4 +67,89 @@ jobs:
6667
platforms: linux/${{ matrix.arch }}
6768
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
6869
tags: ${{ steps.meta.outputs.tags }}
69-
labels: ${{ steps.meta.outputs.labels }}
70+
provenance: false
71+
build-args: |
72+
PYTORCH_VARIANT=${{ matrix.variant }}
73+
74+
create-manifests:
75+
needs: build-and-push
76+
runs-on: ubuntu-latest
77+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
78+
permissions:
79+
packages: write
80+
steps:
81+
- name: Set up QEMU
82+
uses: docker/setup-qemu-action@v3
83+
84+
- name: Setup Docker Buildx
85+
uses: docker/setup-buildx-action@v3
86+
with:
87+
driver-opts: |
88+
image=moby/buildkit:latest
89+
network=host
90+
91+
- name: Log in to GHCR
92+
uses: docker/login-action@v3
93+
with:
94+
registry: ghcr.io
95+
username: ${{ github.actor }}
96+
password: ${{ secrets.GITHUB_TOKEN }}
97+
98+
- name: Create and push CPU manifest
99+
run: |
100+
# Determine the correct tag suffixes based on the event type
101+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
102+
# PR build - use the commit SHA for more predictable references
103+
AMD64_TAG="cpu-amd64-sha-${{ github.sha }}"
104+
ARM64_TAG="cpu-arm64-sha-${{ github.sha }}"
105+
TARGET_TAG="cpu-sha-${{ github.sha }}"
106+
elif [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
107+
# Tag build - use tag version in the name
108+
AMD64_TAG="cpu-amd64-${{ github.ref_name }}"
109+
ARM64_TAG="cpu-arm64-${{ github.ref_name }}"
110+
TARGET_TAG="cpu-${{ github.ref_name }}"
111+
else
112+
# Main branch build - use simple arch tags
113+
AMD64_TAG="cpu-amd64"
114+
ARM64_TAG="cpu-arm64"
115+
TARGET_TAG="cpu"
116+
fi
117+
118+
# Create the manifest with the correct tag names
119+
echo "Creating CPU manifest using $AMD64_TAG and $ARM64_TAG"
120+
docker buildx imagetools create --tag ghcr.io/${{ github.repository }}:${TARGET_TAG} \
121+
ghcr.io/${{ github.repository }}:${AMD64_TAG} \
122+
ghcr.io/${{ github.repository }}:${ARM64_TAG}
123+
124+
# If on main branch, also tag as latest
125+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
126+
docker buildx imagetools create --tag ghcr.io/${{ github.repository }}:latest \
127+
ghcr.io/${{ github.repository }}:${AMD64_TAG} \
128+
ghcr.io/${{ github.repository }}:${ARM64_TAG}
129+
fi
130+
131+
- name: Create and push CUDA manifest
132+
run: |
133+
# Determine the correct tag suffixes based on the event type
134+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
135+
# PR build - use the commit SHA for more predictable references
136+
AMD64_TAG="cuda-amd64-sha-${{ github.sha }}"
137+
ARM64_TAG="cuda-arm64-sha-${{ github.sha }}"
138+
TARGET_TAG="cuda-sha-${{ github.sha }}"
139+
elif [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
140+
# Tag build - use tag version in the name
141+
AMD64_TAG="cuda-amd64-${{ github.ref_name }}"
142+
ARM64_TAG="cuda-arm64-${{ github.ref_name }}"
143+
TARGET_TAG="cuda-${{ github.ref_name }}"
144+
else
145+
# Main branch build - use simple arch tags
146+
AMD64_TAG="cuda-amd64"
147+
ARM64_TAG="cuda-arm64"
148+
TARGET_TAG="cuda"
149+
fi
150+
151+
# Create the manifest with the correct tag names
152+
echo "Creating CUDA manifest using $AMD64_TAG and $ARM64_TAG"
153+
docker buildx imagetools create --tag ghcr.io/${{ github.repository }}:${TARGET_TAG} \
154+
ghcr.io/${{ github.repository }}:${AMD64_TAG} \
155+
ghcr.io/${{ github.repository }}:${ARM64_TAG}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,5 @@ dmypy.json
135135
*.html
136136
.idea/
137137
drafts/
138+
.virtual_documents
139+
.zed

00_index.ipynb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@
66
"source": [
77
"# Introduction\n",
88
"\n",
9-
"- [Introduction to the tutorial](./00-intro.ipynb)\n",
9+
"- [Introduction to the tutorial](./00_intro.ipynb)\n",
1010
"\n",
1111
"# Basic Tutorial\n",
1212
"\n",
13-
"- [Basic datatypes](./01-basic_datatypes.ipynb)\n",
14-
"- [Control Flow](./02-control_flow.ipynb)\n",
15-
"- [Functions](./03-functions.ipynb)\n",
16-
"- [Input-Output](./04-input_output.ipynb)\n",
17-
"- [Object-oriented programming](./05-object_oriented_programming.ipynb)\n",
18-
"- [Modules and packages](./06-modules_and_packages.ipynb)\n",
13+
"- [Basic datatypes](./01_basic_datatypes.ipynb)\n",
14+
"- [Control Flow](./02_control_flow.ipynb)\n",
15+
"- [Functions](./03_functions.ipynb)\n",
16+
"- [Input-Output](./04_input_output.ipynb)\n",
17+
"- [Object-oriented programming](./05_object_oriented_programming.ipynb)\n",
18+
"- [Modules and packages](./06_modules_and_packages.ipynb)\n",
1919
"\n",
2020
"# Advanced tutorial\n",
2121
"\n",
22-
"- [Manage Python project](./10-manage_python_project.ipynb)\n",
23-
"- [Functional programming](./11-functional_programming.ipynb)\n",
24-
"- [Advanced functions](./12-functions_advanced.ipynb)\n",
25-
"- [Advanced Object-oriented programming](./13-object_oriented_programming_advanced.ipynb)\n",
22+
"- [Manage Python project](./10_manage_python_project.ipynb)\n",
23+
"- [Functional programming](./11_functional_programming.ipynb)\n",
24+
"- [Advanced functions](./12_functions_advanced.ipynb)\n",
25+
"- [Advanced Object-oriented programming](./13_object_oriented_programming_advanced.ipynb)\n",
2626
"\n",
2727
"# Libraries\n",
2828
"\n",
29-
"- [Matplotlib](./20-library_matplotlib.ipynb)\n",
30-
"- [NumPy](./21-library_numpy.ipynb)\n",
31-
"- [scikit-learn](./22-library_sklearn.ipynb)\n",
32-
"- [SciPy](./23-library_scipy.ipynb)\n",
33-
"- [Pandas](./24-library_pandas.ipynb)\n",
29+
"- [Matplotlib](./20_library_matplotlib.ipynb)\n",
30+
"- [NumPy](./21_library_numpy.ipynb)\n",
31+
"- [scikit-learn](./22_library_sklearn.ipynb)\n",
32+
"- [SciPy](./23_library_scipy.ipynb)\n",
33+
"- [Pandas](./24_library_pandas.ipynb)\n",
3434
"\n",
3535
"# Additional Topics\n",
3636
"\n",
37-
"- [Parallelism and concurrency in Python](./14-threads.ipynb)\n"
37+
"- [Parallelism and concurrency in Python](./14_threads.ipynb)\n"
3838
]
3939
}
4040
],
@@ -54,7 +54,7 @@
5454
"name": "python",
5555
"nbconvert_exporter": "python",
5656
"pygments_lexer": "ipython3",
57-
"version": "3.12.0"
57+
"version": "3.10.10"
5858
}
5959
},
6060
"nbformat": 4,

0 commit comments

Comments
 (0)