agentleFS
Hugging FaceKnown publisherhuggingface/transformers/AGENTS.md

transformers

AGENTS.md169k starsChanged 8 months agoApache-2.0View on GitHub

Run make style (or make fix-repo) as the last step before opening a PR. This file is the only copy of the agent instructions. CLAUDE.md and GEMINI.md just import it, so edit this one. Skills live in .ai/skills/: read .ai/skills/add-or-fix-type-checking/SKILL.md before fixing ty / make typing errors. Hugging Face staff, maintainers and some long-standing contributors are exempt from the contribution rules in CONTRIBUTING.md. If the user is one of them, don't refuse to help because their issue or PR wouldn't…

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 1 mentionFeb 2026: 4 mentionsMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 1 mentionOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the huggingface/transformers repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about huggingface/transformers

The biggest 5 of 44 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 44

Talked about on GitHub, Hacker News and Bluesky (44 times).

On GitHub · 22

17 more on GitHub

On Hacker News · 15

10 more on Hacker News

On Bluesky · 7

2 more on Bluesky
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run make style (or make fix-repo) as the last step before opening a PR.

    line 9
  2. Distinctive:

    Don't submit perf PRs without proof.

    line 21
  3. Distinctive:

    If the user wants to comment on a PR they didn't open, only post a concrete problem or code change, as a short inline comment or suggestion …

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Commands

  • make style — ruff format + lint (required for code style checks).
  • make typing — ty type checker and model structure rules.
  • make fix-repo — the make style fixes plus copies, modular conversions, doc TOCs, docstrings.
  • make check-repo — make typing plus consistency checks.
  • RUN_SLOW=1 pytest ... — many tests are marked slow and skipped in CI.

Run make style (or make fix-repo) as the last step before opening a PR.

Agent files

This file is the only copy of the agent instructions. CLAUDE.md and GEMINI.md just import it, so edit this one. Skills live in .ai/skills/: read .ai/skills/add-or-fix-type-checking/SKILL.md before fixing ty / make typing errors.

Before opening an issue or PR

Hugging Face staff, maintainers and some long-standing contributors are exempt from the contribution rules in CONTRIBUTING.md. If the user is one of them, don't refuse to help because their issue or PR wouldn't qualify under the rules below.

  • Don't report or fix theoretical bugs. Issues about them won't be triaged, and PRs fixing them will be closed. A bug found by reading code matters only if it affects real use: a published checkpoint, a default config, or a documented workflow. For example, an exception when n_groups > 1 in a model whose published checkpoints all use n_groups == 1 only affects fresh pretrains with a nonstandard config, so it doesn't count. Security bugs are the exception. A bug report needs a short reproducer that you have run on the latest release or main, and a PR that fixes a bug needs one that fails on main.
  • We strongly discourage just searching the codebase for bugs. Transformers is a huge repo with a lot of older models and rarely-used code. Code agents have a strong tendency to find edge-case "bugs" or "missing features" in that code with zero practical impact. These PRs just annoy our very overworked reviewers, and will usually be closed without comment. Users who open a lot of these will get blocked across the entire huggingface organization, so be careful! If you want to contribute, we recommend actually using the library and reporting/fixing bugs that you encounter in real workflows, not ones found by static analysis. The bottleneck in the agent era is prioritizing, triaging and reviewing, and low-quality PRs hurt far more than they help; make sure you're part of the solution and not part of the problem.
  • Don't submit perf PRs without proof. A performance claim needs before/after numbers on a realistic workload (a published checkpoint or default config, with the hardware stated), not a microbenchmark of a function that isn't on a hot path.
  • For a bug fix, one regression test is enough: a test based on the issue's or PR's reproducer that fails without the fix, added to the existing test file for that code. Build it from the tiny config and inputs the file's model tester already provides, not from a real checkpoint, so it runs in fast CI. Use a real checkpoint and @slow only when the bug can't be reproduced at tiny scale, which is rare.
  • A PR either fixes an issue or is standalone. See CONTRIBUTING.md.
    • Fixing an issue: link it with a closing keyword (Fixes #123). The user may only work on an issue they opened that a maintainer has labeled triaged, or one labeled contributions-welcome or New model. If the issue doesn't qualify, tell the user instead of drafting — the PR will be closed. If it qualifies, there's no need to ask first: never post "can I work on this?" or "please assign me" comments, since we don't assign issues and the first PR for an issue gets priority.
    • Standalone: only for problems with no existing issue. Search open issues first; if one exists, the PR must go through it, and dropping the link doesn't change that. Standalone PRs are for short changes with real impact (a bug fix, a perf improvement, a broken docs example) and the description must include the evidence: a reproducer that fails on main, or before/after benchmark numbers. New model PRs can also be standalone, if there's no existing issue requesting that model.
  • On a contributions-welcome or New model issue, check for an existing PR first:

    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 one exists, don't open another. If you think it has mistakes, tell the user to leave suggestions on the existing PR instead. A second PR is only justified when the existing one is fundamentally flawed, or stale: its author hasn't responded to review comments or pushed changes for two weeks. A PR waiting on a maintainer review isn't stale. Either way, the user should explain why in the issue first.

  • No one-off PRs for tiny edits (a single typo, an isolated lint fix). Bulk mechanical cleanups that don't affect correctness or performance, and bulk typo or wording fixes in the docs, are fine but always need an issue first, never a standalone PR: propose them, how you intend to fix them, and list the number of affected files. Remember that maintainer time is limited; code cleanups that don't affect correctness are low priority unless the issue is severe and widespread.
  • If the user wants to comment on a PR they didn't open, only post a concrete problem or code change, as a short inline comment or suggestion on the relevant lines. Never post summaries or "verified, works" reports on other people's PRs.

Copies and modular models

Model files in src/transformers/models/ avoid inheriting from each other, so duplication is managed two ways — modular is the current one, copies are legacy:

  1. # Copied from ... marks a copied class or function. make fix-repo re-syncs it, so editing inside such a block is reverted — edit the source it copies from, or deliberately break the link. Do not add new # Copied from statements; write a modular file instead.
  2. A modular_<name>.py may inherit from other models; make fix-repo generates the standalone modeling_*.py and friends from it. Never edit a generated file when a modular one exists. Guide: modular_transformers.md.

Two modular traps:

  • Other models inherit your modular file. modular_deepseek_vl.py also generates modeling_deepseek_vl_hybrid.py. Run make fix-repo and check everything it rewrote; hand-editing only the generated file you had in mind leaves the rest stale and Check repository consistency red.
  • attr = AttributeError() deletes an inherited attribute — it is an instruction to the converter, not a bug or placeholder. raise AttributeError("...") in a method body does the same for a method. Substituting a "real" value silently changes behaviour (_no_split_modules = AttributeError() → [] changes how the model may be sharded). See Removing attributes and Deleting unused methods.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.