Skip to content

Pin torchvision, torch, and torchaudio versions#13757

Merged
sayakpaul merged 5 commits into
mainfrom
pin-torchvsion
May 29, 2026
Merged

Pin torchvision, torch, and torchaudio versions#13757
sayakpaul merged 5 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.

@sayakpaul
Copy link
Copy Markdown
Member Author

@DN6 a gentle ping on the above because it affects our slow CI.

Copy link
Copy Markdown
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@yiyixuxu
Copy link
Copy Markdown
Collaborator

fast tests are failing too now, let's merge in to see if it got fixed?

@sayakpaul
Copy link
Copy Markdown
Member Author

@yiyixuxu going to merge after pushing the Docker containers: https://github.com/huggingface/diffusers/actions/runs/26613347105

The fast tests seem okay on: #13781

The failures are unrelated to env setup.

@sayakpaul sayakpaul merged commit 537b7fc into main May 29, 2026
14 checks passed
@sayakpaul sayakpaul deleted the pin-torchvsion branch May 29, 2026 02:04
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.

3 participants