Skip to content

Commit 9fa9e9c

Browse files
committed
Make Docker build and upload scripts runnable through pip
1 parent e3dbd54 commit 9fa9e9c

34 files changed

Lines changed: 105 additions & 51 deletions

.github/workflows/UploadDockerImages.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ jobs:
6565
- device: tpu
6666
build_mode: stable
6767
image_name: maxtext_jax_stable
68-
dockerfile: ./dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
68+
dockerfile: ./src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
6969
- device: tpu
7070
build_mode: nightly
7171
image_name: maxtext_jax_nightly
72-
dockerfile: ./dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
72+
dockerfile: ./src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
7373
uses: ./.github/workflows/build_and_push_docker_image.yml
7474
with:
7575
image_name: ${{ matrix.image_name }}
@@ -88,7 +88,7 @@ jobs:
8888
device: tpu
8989
build_mode: stable
9090
workflow: post-training
91-
dockerfile: ./dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
91+
dockerfile: ./src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile
9292
maxtext_sha: ${{ needs.setup.outputs.maxtext_sha }}
9393
image_date: ${{ needs.setup.outputs.image_date }}
9494

@@ -101,7 +101,7 @@ jobs:
101101
device: tpu
102102
build_mode: nightly
103103
workflow: post-training
104-
dockerfile: ./dependencies/dockerfiles/maxtext_post_training_local_dependencies.Dockerfile
104+
dockerfile: ./src/dependencies/dockerfiles/maxtext_post_training_local_dependencies.Dockerfile
105105
maxtext_sha: ${{ needs.setup.outputs.maxtext_sha }}
106106
image_date: ${{ needs.setup.outputs.image_date }}
107107
base_image: gcr.io/tpu-prod-env-multipod/maxtext_post_training_stable:${{ needs.setup.outputs.image_date }}
@@ -116,11 +116,11 @@ jobs:
116116
- device: gpu
117117
build_mode: stable
118118
image_name: maxtext_gpu_jax_stable
119-
dockerfile: ./dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile
119+
dockerfile: ./src/dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile
120120
- device: gpu
121121
build_mode: nightly
122122
image_name: maxtext_gpu_jax_nightly
123-
dockerfile: ./dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile
123+
dockerfile: ./src/dependencies/dockerfiles/maxtext_gpu_dependencies.Dockerfile
124124
uses: ./.github/workflows/build_and_push_docker_image.yml
125125
with:
126126
image_name: ${{ matrix.image_name }}

.github/workflows/build_and_upload_images.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if [[ ! -v CLOUD_IMAGE_NAME ]] || [[ ! -v PROJECT ]] || [[ ! -v MODE ]] || [[ !
4949
fi
5050

5151
gcloud auth configure-docker us-docker.pkg.dev --quiet
52-
bash "$MAXTEXT_REPO_ROOT"'/dependencies/scripts/docker_build_dependency_image.sh' LOCAL_IMAGE_NAME=$LOCAL_IMAGE_NAME MODE="$MODE" DEVICE="$DEVICE"
52+
bash "$MAXTEXT_REPO_ROOT"'/src/dependencies/scripts/docker_build_dependency_image.sh' LOCAL_IMAGE_NAME=$LOCAL_IMAGE_NAME MODE="$MODE" DEVICE="$DEVICE"
5353
image_date=$(date +%Y-%m-%d)
5454

5555
# Upload only dependencies image
@@ -65,7 +65,7 @@ if ! gcloud storage cp gs://maxtext-test-assets/* "${MAXTEXT_TEST_ASSETS_ROOT:-$
6565
fi
6666

6767
# Build then upload "dependencies + code" image
68-
docker build --build-arg BASEIMAGE=${LOCAL_IMAGE_NAME} -f "$MAXTEXT_REPO_ROOT"'/dependencies/dockerfiles/maxtext_runner.Dockerfile' -t ${LOCAL_IMAGE_NAME}_runner .
68+
docker build --build-arg BASEIMAGE=${LOCAL_IMAGE_NAME} -f "$MAXTEXT_REPO_ROOT"'/src/dependencies/dockerfiles/maxtext_runner.Dockerfile' -t ${LOCAL_IMAGE_NAME}_runner .
6969
docker tag ${LOCAL_IMAGE_NAME}_runner gcr.io/$PROJECT/${CLOUD_IMAGE_NAME}:latest
7070
docker push gcr.io/$PROJECT/${CLOUD_IMAGE_NAME}:latest
7171
docker tag ${LOCAL_IMAGE_NAME}_runner gcr.io/$PROJECT/${CLOUD_IMAGE_NAME}:${image_date}

.github/workflows/check_docs_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: uv venv --python 3.12 $GITHUB_WORKSPACE/venv
2828

2929
- name: Install dependencies
30-
run: . $GITHUB_WORKSPACE/venv/bin/activate && uv pip install -r dependencies/requirements/requirements_docs.txt
30+
run: . $GITHUB_WORKSPACE/venv/bin/activate && uv pip install -r src/dependencies/requirements/requirements_docs.txt
3131

3232
- name: Build documentation
3333
run: |

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ sphinx:
2121
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
2222
python:
2323
install:
24-
- requirements: dependencies/requirements/requirements_docs.txt
24+
- requirements: src/dependencies/requirements/requirements_docs.txt

PREFLIGHT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bash preflight.sh PLATFORM=GCE && numactl --membind 0 --cpunodebind=0 python3 -m
2626
```
2727

2828
For GKE,
29-
`numactl` should be built into your docker image from [maxtext_tpu_dependencies.Dockerfile](https://github.com/google/maxtext/blob/main/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile), so you can use it directly if you built the maxtext docker image. Here is an example
29+
`numactl` should be built into your docker image from [maxtext_tpu_dependencies.Dockerfile](https://github.com/google/maxtext/blob/main/src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile), so you can use it directly if you built the maxtext docker image. Here is an example
3030

3131
```
3232
bash preflight.sh PLATFORM=GKE && numactl --membind 0 --cpunodebind=0 python3 -m maxtext.trainers.pre_train.train src/maxtext/configs/base.yml run_name=${YOUR_JOB_NAME?}

build_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import os
1818
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
1919

20-
TPU_REQUIREMENTS_PATH = "dependencies/requirements/generated_requirements/tpu-requirements.txt"
20+
TPU_REQUIREMENTS_PATH = "src/dependencies/requirements/generated_requirements/tpu-requirements.txt"
2121

2222

2323
def get_tpu_dependencies():

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you are writing documentation for MaxText, you may want to preview the docume
1212
First, make sure you install the necessary dependencies. You can do this by navigating to your local clone of the MaxText repo and running:
1313

1414
```bash
15-
pip install -r dependencies/requirements/requirements_docs.txt
15+
pip install -r src/dependencies/requirements/requirements_docs.txt
1616
```
1717

1818
Once the dependencies are installed, you can navigate to the `docs/` folder and run:

docs/install_maxtext.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Run the following command, replacing `<jax-build-commit-hash>` with the hash you
127127

128128
```bash
129129
seed-env \
130-
--local-requirements=dependencies/requirements/base_requirements/tpu-base-requirements.txt \
130+
--local-requirements=src/dependencies/requirements/base_requirements/tpu-base-requirements.txt \
131131
--host-name=MaxText \
132132
--seed-commit=<jax-build-commit-hash> \
133133
--python-version=3.12 \
@@ -141,7 +141,7 @@ Similarly, run the command for the GPU requirements.
141141

142142
```bash
143143
seed-env \
144-
--local-requirements=dependencies/requirements/base_requirements/cuda12-base-requirements.txt \
144+
--local-requirements=src/dependencies/requirements/base_requirements/cuda12-base-requirements.txt \
145145
--host-name=MaxText \
146146
--seed-commit=<jax-build-commit-hash> \
147147
--python-version=3.12 \

docs/run_maxtext/run_maxtext_via_pathways.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Before you can run a MaxText workload, you must complete the following setup ste
4040
Step 1: Build the Docker image for a TPU device. This image contains MaxText and its dependencies.
4141

4242
```shell
43-
bash dependencies/scripts/docker_build_dependency_image.sh DEVICE=tpu MODE=stable
43+
bash src/dependencies/scripts/docker_build_dependency_image.sh DEVICE=tpu MODE=stable
4444
```
4545

4646
Step 2: Configure Docker to authenticate with Google Cloud
@@ -52,7 +52,7 @@ Before you can run a MaxText workload, you must complete the following setup ste
5252
Step 3: Upload the image to your project's registry. Replace `$USER_runner` with your desired image name.
5353

5454
```shell
55-
bash dependencies/scripts/docker_upload_runner.sh CLOUD_IMAGE_NAME=$USER_runner
55+
bash src/dependencies/scripts/docker_upload_runner.sh CLOUD_IMAGE_NAME=$USER_runner
5656
```
5757

5858
## 2. Environment configuration

docs/run_maxtext/run_maxtext_via_xpk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ ______________________________________________________________________
130130
- **For TPUs:**
131131

132132
```
133-
bash dependencies/scripts/docker_build_dependency_image.sh DEVICE=tpu MODE=stable
133+
bash src/dependencies/scripts/docker_build_dependency_image.sh DEVICE=tpu MODE=stable
134134
```
135135
136136
- **For GPUs:**
137137
138138
```
139-
bash dependencies/scripts/docker_build_dependency_image.sh DEVICE=gpu MODE=stable
139+
bash src/dependencies/scripts/docker_build_dependency_image.sh DEVICE=gpu MODE=stable
140140
```
141141
142142
______________________________________________________________________

0 commit comments

Comments
 (0)