Fix docker image build for Latest PyTorch + TensorFlow [dev]#29764
Fix docker image build for Latest PyTorch + TensorFlow [dev]#29764
Latest PyTorch + TensorFlow [dev]#29764Conversation
| # to be used as arguments for docker build (so far). | ||
|
|
||
| ARG PYTORCH='2.2.0' | ||
| ARG PYTORCH='2.2.1' |
There was a problem hiding this comment.
let's use the latest one
| ARG PYTORCH='2.2.0' | ||
| ARG PYTORCH='2.2.1' | ||
| # (not always a valid torch version) | ||
| ARG INTEL_TORCH_EXT='2.2.0' |
There was a problem hiding this comment.
no 2.2.1 available for INTEL_TORCH_EXT yet. But I guess it's fine
| # Currently, let's just use their latest releases (when `torch` is installed with a release version) | ||
| # TODO: We might need to specify proper versions that work with a specific torch version (especially for past CI). | ||
| RUN [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA || python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA | ||
| RUN python3 -m pip install --no-cache-dir -U tensorflow==2.13 protobuf==3.20.3 tensorflow_text tensorflow_probability && python3 -m pip install --no-cache-dir -e ./transformers[dev,onnxruntime] && [ ${#PYTORCH} -gt 0 -a "$PYTORCH" != "pre" ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; echo "export VERSION='$VERSION'" >> ~/.profile && echo torch=$VERSION && [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA || python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA |
There was a problem hiding this comment.
put everything in a single RUN ... to reduce the layers and size.
There was a problem hiding this comment.
This is such a hack 😅
I think we still want some of the comments to provide context
There was a problem hiding this comment.
Added back (part of) the previous comments
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
Hm, the last run on |
| # Currently, let's just use their latest releases (when `torch` is installed with a release version) | ||
| # TODO: We might need to specify proper versions that work with a specific torch version (especially for past CI). | ||
| RUN [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA || python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA | ||
| RUN python3 -m pip install --no-cache-dir -U tensorflow==2.13 protobuf==3.20.3 tensorflow_text tensorflow_probability && python3 -m pip install --no-cache-dir -e ./transformers[dev,onnxruntime] && [ ${#PYTORCH} -gt 0 -a "$PYTORCH" != "pre" ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; echo "export VERSION='$VERSION'" >> ~/.profile && echo torch=$VERSION && [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA || python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA |
There was a problem hiding this comment.
This is such a hack 😅
I think we still want some of the comments to provide context
What does this PR do?
It's unknown why the image/layers could not be exported and pushed. The best guess is that it is way too large for which I don't know the limitation.
This PR combines several steps in one single
RUN ...command in the dockerfile so the size is smaller.Successful build: https://github.com/huggingface/transformers/actions/runs/8365229494/job/22902558338