Skip to content

Commit

Permalink
unify working directory and add more gpu dependency files
Browse files Browse the repository at this point in the history
  • Loading branch information
sizhit2 committed Oct 15, 2024
1 parent bb182c4 commit a5ee4cf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docker_build_dependency_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ COMMIT_HASH=$(git rev-parse --short HEAD)
echo "Building MaxDiffusion with MODE=${MODE} at commit hash ${COMMIT_HASH} . . ."

if [[ ${DEVICE} == "gpu" ]]; then
if [[ ${MODE} == "pinned" ]]; then
export BASEIMAGE=ghcr.io/nvidia/jax:base-2024-05-07
else
export BASEIMAGE=ghcr.io/nvidia/jax:base
fi
docker build --network host --build-arg MODE=${MODE} --build-arg JAX_VERSION=$JAX_VERSION --build-arg DEVICE=$DEVICE --build-arg BASEIMAGE=$BASEIMAGE -f ./maxdiffusion_gpu_dependencies.Dockerfile -t ${LOCAL_IMAGE_NAME} .
else
if [[ "${MODE}" == "stable_stack" ]]; then
Expand Down
9 changes: 9 additions & 0 deletions docs/getting_started/run_maxdiffusion_via_xpk.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ after which log out and log back in to the machine.
**Important Note:** The JAX Stable Stack is currently in the experimental phase. We encourage you to try it out and provide feedback.
#### Run MaxDiffusion on GPU
Default device is TPU. To run MaxDiffusion on GPU, please explicitly specify GPU When building docker image.
```shell
# Default will pick base image.
bash docker_build_dependency_image.sh DEVICE=gpu
```
3. After building the dependency image `maxdiffusion_base_image`, xpk can handle updates to the working directory when running `xpk workload create` and using `--base-docker-image`.
See details on docker images in xpk here: https://github.com/google/xpk/blob/main/README.md#how-to-add-docker-images-to-a-xpk-workload
Expand Down
2 changes: 1 addition & 1 deletion maxdiffusion_dependencies.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ARG JAX_VERSION
ENV ENV_JAX_VERSION=$JAX_VERSION

# Set the working directory in the container
WORKDIR /app
WORKDIR /deps

# Copy all files from local workspace into docker container
COPY . .
Expand Down
4 changes: 2 additions & 2 deletions maxdiffusion_jax_stable_stack_tpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ ARG COMMIT_HASH

ENV COMMIT_HASH=$COMMIT_HASH

RUN mkdir -p /app
RUN mkdir -p /deps

# Set the working directory in the container
WORKDIR /app
WORKDIR /deps

# Copy all files from local workspace into docker container
COPY . .
Expand Down
4 changes: 2 additions & 2 deletions maxdiffusion_runner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG BASEIMAGE=maxdiffusion_base_image
FROM $BASEIMAGE

# Set the working directory in the container
WORKDIR /app
WORKDIR /deps

# Copy all files from local workspace into docker container
COPY . .

WORKDIR /app
WORKDIR /deps

0 comments on commit a5ee4cf

Please sign in to comment.