-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[diffusers-cli] add a dockerfile for diffusers cli hf jobs #14550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
aa3951a
add a dockerfile for diffusers cli hf jobs
sayakpaul c635ca0
up
sayakpaul 0d2813b
up
sayakpaul 885873e
Merge branch 'main' into diffusers-cli-cuda-docker
sayakpaul 49ea9cf
use diffusers from pypi
sayakpaul e48741f
Merge branch 'main' into diffusers-cli-cuda-docker
sayakpaul b52d488
Merge branch 'main' into diffusers-cli-cuda-docker
sayakpaul 8779b4d
Merge branch 'main' into diffusers-cli-cuda-docker
sayakpaul d1d488b
resolve conflicts
sayakpaul c61c6f1
up
sayakpaul 9f4e57c
fix(ci): harden GitHub Actions workflows (#14550) (#14851)
hf-security-analysis[bot] f9bd557
Apply batched suggestions from code review
sayakpaul 5af8fda
Merge branch 'main' into diffusers-cli-cuda-docker
sayakpaul 2ec86e9
lower bound for tokenizers.
sayakpaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Prebuilt image for `diffusers-cli run --remote`, so a sandbox starts straight into the run | ||
| # instead of installing the dependency set on every cold boot. | ||
| # | ||
| # The base is the same image the CLI used to boot into, so the torch + CUDA layer is unchanged: | ||
| # cuda12.8 is the highest cuda12.x tag below the HF Jobs host driver's CUDA 12.9 max. | ||
| # | ||
| # The Python deps below mirror `_DEFAULT_REMOTE_DEPS` in `src/diffusers/commands/run.py` — | ||
| # keep the two lists in sync. | ||
| FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime | ||
| LABEL maintainer="Hugging Face" | ||
| LABEL repository="diffusers" | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
| ENV PYTHONDONTWRITEBYTECODE=1 | ||
| # Weight loading dominates what is left of the startup cost. Xet-accelerated downloads come from | ||
| # the `huggingface_hub[hf_xet]` install below (on by default once `hf_xet` is present); parallel | ||
| # shard loading is opt-in, and the sandbox env at creation time can still override it. | ||
| ENV HF_ENABLE_PARALLEL_LOADING=1 | ||
|
|
||
| # libgl1/libglib2.0-0 back PIL + the cv2 video fallback; libsndfile1 backs torchaudio decoding. | ||
| RUN apt-get -y update && apt-get install -y --no-install-recommends \ | ||
| bash \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| git-lfs \ | ||
| libgl1 \ | ||
| libglib2.0-0 \ | ||
| libsndfile1 \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| ENV PATH="/root/.local/bin:$PATH" | ||
|
|
||
| # torch, torchvision, and torchaudio come from the base image as a matching set — never reinstall | ||
| # them here, an ABI mismatch breaks the torchvision/torchaudio C++ extensions. Fail the build | ||
| # instead if that assumption ever stops holding. | ||
| RUN python -c "import torch, torchvision, torchaudio" | ||
|
|
||
| # `uv pip install --system` targets the base image's Python — Ubuntu's system interpreter, which | ||
| # is where torch already lives and where the CLI installs `--dependencies` extras at runtime. | ||
| # --break-system-packages bypasses the PEP 668 marker that interpreter carries; harmless in a | ||
| # single-purpose image, and it matches what the CLI does inside the sandbox. | ||
| # | ||
| # `diffusers` comes from PyPI so the image ships a released version. A run that needs `main` (or any | ||
| # other build) can install over it with `--dependencies` or point `--image` at a custom image. | ||
| RUN uv pip install --system --break-system-packages --no-cache-dir \ | ||
| "huggingface_hub[hf_xet]>=1.32" \ | ||
| diffusers \ | ||
| accelerate \ | ||
| transformers \ | ||
| "tokenizers>=0.14.0" \ | ||
| safetensors \ | ||
| sentencepiece \ | ||
| ftfy \ | ||
| peft \ | ||
| imageio \ | ||
| imageio-ffmpeg | ||
|
|
||
| # Smoke-test the console script the sandbox invokes, so a broken install fails the build. | ||
| RUN diffusers-cli env | ||
|
sayakpaul marked this conversation as resolved.
|
||
| RUN diffusers-cli run --help | ||
|
|
||
| CMD ["/bin/bash"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to run this check since env doesn't cover the CLI run command.