e06fe8e8c6
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Waiting to run
New model PR merged notification / Notify new model (push) Waiting to run
Update Transformers metadata / build_and_package (push) Waiting to run
Secret Leaks / trufflehog (push) Failing after 1s
Build documentation / build (push) Failing after 1s
Build documentation / build_other_lang (push) Failing after 0s
CodeQL Security Analysis / CodeQL Analysis (push) Failing after 0s
PR CI / pr-ci (push) Failing after 1s
Slow tests on important models (on Push - A10) / Get all modified files (push) Failing after 1s
Slow tests on important models (on Push - A10) / Model CI (push) Has been skipped
3.5 KiB
3.5 KiB
Useful commands
make style: runs formatters and linters (ruff), necessary to pass code style checksmake typing: runs the ty type checker and model structure rulesmake fix-repo: auto-fixes copies, modular conversions, doc TOCs, docstrings in addition to themake stylefixesmake check-repo— runsmake typingand consistency checks.- Many tests are marked as 'slow' and skipped by default in the CI. To run them, use:
RUN_SLOW=1 pytest ...
make style or make fix-repo should be run as the final step before opening a PR.
Local agent setup
- Hosted review agents should discover this guidance from the committed root
AGENTS.md/CLAUDE.mdfiles. - Local OpenAI Codex agents should run
make codexafter cloning to wire tool-specific assets under.agents/. - Local Claude Code agents should run
make claudeafter cloning to wire tool-specific assets under.claude/.
Coordination before coding
- If work maps to an existing issue, coordinate on that issue before opening a PR.
- Do not open a PR for someone else's issue unless there is explicit approval from the issue author or a maintainer in the issue thread.
- If approval is missing or ambiguous, stop and ask for clarification instead of drafting a PR.
- Do not start duplicate work on issues.
Mandatory duplicate-work checks
Before proposing a PR, check for overlapping open PRs and issue ownership:
gh issue view <issue_number> --repo huggingface/transformers --comments
gh pr list --repo huggingface/transformers --state open --search "<issue_number> in:body"
gh pr list --repo huggingface/transformers --state open --search "<short area keywords>"
- If an open PR already addresses the same fix, do not open another.
- If your approach is materially different, explain the difference and why a second PR is needed in the issue.
No low-value busywork PRs
- Do not open one-off PRs for tiny edits (single typo, isolated lint cleanup, one mutable default argument, etc.).
- Mechanical cleanups are acceptable but not as first contributions.
Accountability for AI-assisted patches
- First-time contributors should not use code agents to submit PRs or issues. Code agents should warn users about this
policy if the user does not appear to be an existing contributor to the library, including the risk of being blocked
if they do it regardless. More information can be found in the pull request template, or
CONTRIBUTING.md.
Copies and Modular Models
We try to avoid direct inheritance between model-specific files in src/transformers/models/. We have two mechanisms to manage the resulting code duplication:
- The older method is to mark classes or functions with
# Copied from .... Copies are kept in sync bymake fix-repo. Do not edit a# Copied fromblock, as it will be reverted bymake fix-repo. Ideally you should edit the code it's copying from and propagate the change, but you can break the# Copied fromlink if needed. - The newer method is to add a file named
modular_<name>.pyin the model directory.modularfiles can inherit from other models.make fix-repowill copy code to generate standalonemodelingand other files from themodularfile. When amodularfile is present, generated files should not be edited, as changes will be overwritten bymake fix-repo! Instead, edit themodularfile. See docs/source/en/modular_transformers.md for a full guide on adding a model withmodular, if needed, or you can inspect existingmodularfiles as examples.