Skip to content

Commit

Permalink
upgrade tpu tf to 2.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
djherbis committed Jan 3, 2025
1 parent 3cba809 commit 1ddb233
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
10 changes: 0 additions & 10 deletions tpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ FROM $BASE_IMAGE
# See: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PYTHON_WHEEL_VERSION
ARG PYTHON_VERSION_PATH
ARG TF_LINUX_WHEEL_VERSION
ARG TORCH_LINUX_WHEEL_VERSION
ARG TORCH_VERSION
ARG TENSORFLOW_VERSION
ARG TF_LIBTPU_VERSION
ARG TORCHVISION_VERSION
ARG TORCHAUDIO_VERSION

Expand Down Expand Up @@ -68,17 +65,11 @@ RUN export PATH="${HOME}/.local/bin:${PATH}" && uv pip install --system -r /requ
/tmp/clean-layer.sh
ENV PATH="${HOME}/.local/bin:${PATH}"

# Tensorflow libtpu:
RUN curl --output /usr/local/lib/python3.10/site-packages/libtpu/libtpu.so https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/libtpu/${TF_LIBTPU_VERSION}/libtpu.so

# Kaggle Model Hub patches:
ADD patches/kaggle_module_resolver.py /usr/local/lib/${PYTHON_VERSION_PATH}/site-packages/tensorflow_hub/kaggle_module_resolver.py
RUN sed -i '/from tensorflow_hub import uncompressed_module_resolver/a from tensorflow_hub import kaggle_module_resolver' /usr/local/lib/${PYTHON_VERSION_PATH}/site-packages/tensorflow_hub/config.py
RUN sed -i '/_install_default_resolvers()/a \ \ registry.resolver.add_implementation(kaggle_module_resolver.KaggleFileResolver())' /usr/local/lib/${PYTHON_VERSION_PATH}/site-packages/tensorflow_hub/config.py

# Monkey-patch the default TPU to the local (TPU VM).
RUN sed -i 's/tpu=None,/tpu="local",/' /usr/local/lib/${PYTHON_VERSION_PATH}/site-packages/tensorflow/python/distribute/cluster_resolver/tpu/tpu_cluster_resolver.py

# Set these env vars so that they don't produce errs calling the metadata server to load them:
ENV TPU_ACCELERATOR_TYPE=v3-8
ENV TPU_PROCESS_ADDRESSES=local
Expand All @@ -92,7 +83,6 @@ LABEL build-date=$BUILD_DATE
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_DATE=${BUILD_DATE}

LABEL tensorflow-version=$TENSORFLOW_VERSION
LABEL kaggle-lang=python

# Correlate current release with the git hash inside the kernel editor by running `!cat /etc/git_commit`.
Expand Down
4 changes: 0 additions & 4 deletions tpu/config.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
BASE_IMAGE=python:3.10
PYTHON_WHEEL_VERSION=cp310
PYTHON_VERSION_PATH=python3.10
# gsutil ls gs://cloud-tpu-tpuvm-artifacts/tensorflow
# https://cloud.google.com/tpu/docs/supported-tpu-configurations#libtpu_versions
TENSORFLOW_VERSION=2.16.1
TF_LIBTPU_VERSION=1.10.1
TF_LINUX_WHEEL_VERSION=manylinux_2_17_x86_64.manylinux2014_x86_64
# gsutil ls gs://pytorch-xla-releases/wheels/tpuvm/* | grep libtpu | grep torch_xla | grep -v -E ".*rc[0-9].*" | sed 's/.*torch_xla-\(.*\)+libtpu.*/\1/' | sort -rV
# Supports nightly
Expand Down
4 changes: 2 additions & 2 deletions tpu/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# TPU Utils
tpu-info
# Tensorflow packages
https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/tensorflow/tf-${TENSORFLOW_VERSION}/tensorflow-${TENSORFLOW_VERSION}-${PYTHON_WHEEL_VERSION}-${PYTHON_WHEEL_VERSION}-${TF_LINUX_WHEEL_VERSION}.whl
tensorflow-tpu>=2.18.0
-f https://storage.googleapis.com/libtpu-tf-releases/index.html
tensorflow_hub
tensorflow-io
tensorflow-probability
Expand Down Expand Up @@ -36,7 +37,6 @@ albumentations
diffusers
einops
fastparquet
librosa
matplotlib
opencv-python
opencv-python-headless
Expand Down

0 comments on commit 1ddb233

Please sign in to comment.