Skip to content

Pin torchvision, torch, and torchaudio versions#13757

Open
sayakpaul wants to merge 4 commits into
mainfrom
pin-torchvsion
Open

Pin torchvision, torch, and torchaudio versions#13757
sayakpaul wants to merge 4 commits into
mainfrom
pin-torchvsion

Conversation

@sayakpaul
Copy link
Copy Markdown
Member

@sayakpaul sayakpaul commented May 15, 2026

What does this PR do?

Facing torchvision problems because of unpinned versions:
https://github.com/huggingface/diffusers/actions/runs/25903410768/job/76131726872?pr=13733

This PR should fix it.

Pushed the Docker containers too: https://github.com/huggingface/diffusers/actions/runs/25907563120.

Tested with the container and verified that it's working as expected.

@github-actions github-actions Bot added the size/S PR with diff < 50 LOC label May 15, 2026
@sayakpaul sayakpaul changed the title up Pin torchvision, torch, and torchaudio versions May 15, 2026
@sayakpaul sayakpaul requested a review from DN6 May 15, 2026 08:31
@DN6
Copy link
Copy Markdown
Collaborator

DN6 commented May 20, 2026

I think we tend to pin/unpin frequently enough that we can add build args to the env section in.github/workflows/build_docker_images.yml and build the docker images based on these. Changes needed

In the build images workflow

 env:
   REGISTRY: diffusers
   CI_SLACK_CHANNEL: ${{ secrets.CI_DOCKER_CHANNEL }}
   TORCH_VERSION: 2.10.0 # set to "" to use latest 

Update the build instructions

        with:
          no-cache: true
          context: ./docker/${{ matrix.image-name }}
          push: true
          tags: ${{ env.REGISTRY }}/${{ matrix.image-name }}:latest
          build-args: |
            TORCH_VERSION=${{ env.TORCH_VERSION }}

torchvision and torchaudio will resolve to the appropriate versions based on the torch version.

Inside the Dockerfile, we would need

RUN uv pip install --no-cache-dir \
    "torch${TORCH_VERSION:+==${TORCH_VERSION}}" \
    torchvision \
    torchaudio \
    --extra-index-url https://download.pytorch.org/whl/cpu

@sayakpaul
Copy link
Copy Markdown
Member Author

torchvision and torchaudio will resolve to the appropriate versions based on the torch version.

But when we do pip install torch (the current stage):

RUN uv pip install --no-cache-dir \
    torch \
    torchvision \
    torchaudio 

somehow the resolution isn't appropriate.

--extra-index-url https://download.pytorch.org/whl/cpu

This feels inappropriate for non-CPU envs i.e., for the GPU docker containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants