mirror of
https://github.com/huggingface/transformers.git
synced 2026-10-28 16:54:55 +08:00
* Move the GPU CI images to the Python in `.python-version` The NVIDIA images (all-latest, quantization, deepspeed-latest) and the AMD DeepSpeed image used Ubuntu 22.04's system Python 3.10. They now get Python from uv at `PYTHON_VERSION`, in a venv on PATH (same setup as transformers-intel-cpu), so `python`, `python3` and `pip` resolve to it. `python-is-python3` is no longer needed for DeepSpeed's `#!/usr/bin/env python` scripts. transformers-pytorch-amd-gpu ships torch in its base image's Python, so its base tag is picked from `PYTHON_VERSION` (rocm7.2_ubuntu22.04_py3.11_pytorch_release_2.10.0). AMD only publishes pre-built flash-attn wheels for Python 3.10, so flash-attn is now built from source, from the commit AMD's wheel was built from (0e60e39) and for the same gfx942/gfx950 targets. The build workflows pass `PYTHON_VERSION` from `.python-version`. Unused images (pytorch-gpu, transformers-gpu, pytorch-tpu, deepspeed-nightly) are left as they are. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Allow building test GPU images with a postfix from workflow_dispatch Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Remove the GitHub API cache-bust from the AMD docker images * Bust the AMD images' clone cache with the commit being built Replaces the removed GitHub API `ADD`: the build workflow now passes `REF=${{ github.sha }}` to the AMD images, so the `git checkout $REF` step (and every layer after it) changes, and is rebuilt, for each new commit. No network call, and the image is pinned to the commit it was built from. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the common GPU image steps through a `gpu-common` build context The GPU dockerfiles start from different CUDA/ROCm base images, so they can't share a base image, but they repeated the same steps on top of them. These now live in `docker/gpu-common/`, passed to the builds as the `gpu-common` named build context: - `install-python.sh`: Python from `PYTHON_VERSION` with uv, in a venv (all-latest, quantization, deepspeed-latest, deepspeed-amd) - `finish-transformers-install.sh`: uninstall `kernels` + `setup.py develop` (all five images) - `check-torch.sh`: import torch and check it still matches the `PYTORCH` pin (all-latest, quantization, and now deepspeed-latest) The torch installs stay per image, their differences are intended. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Install a pre-built flash-attention wheel in the AMD image AMD's mirror has no Python 3.11 flash-attention wheel, and building the CK backend from source on the image builder takes hours. Use the torch 2.10 / cp311 ROCm wheel from mjun0812/flash-attention-prebuild-wheels instead, pinned by checksum, and import it at build time to catch an ABI mismatch with the base image's torch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Build flash-attention from source in the AMD image, tuned like the NVIDIA one Drop the third-party pre-built wheel and build the CK backend from the upstream commit AMD's wheel was built from, with the same tweaks as the NVIDIA FA2 build: MAX_JOBS derived from the runner's RAM (setup.py's default leaves most of the runner idle) and a filtered build log, since hipify's output fills BuildKit's per-step log limit before compilation starts. Give the AMD image job an explicit timeout below GitHub's 6h default. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Leave the AMD PyTorch image out of the Python move #49460 moves `transformers-pytorch-amd-gpu` to a ROCm 10 / Python 3.14 base image that ships flash-attention, while AMD only publishes Python 3.10 flash-attention wheels for the current base and building them from source takes hours. Keep that image (Dockerfile and build job) as on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Drop the image postfix input of workflow_dispatch It was only needed to build test images for this PR. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>