Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Pull request checks","local":"pull-request-checks","sections":[{"title":"Fixing the CI","local":"fixing-the-ci","sections":[],"depth":2},{"title":"Code quality","local":"code-quality","sections":[],"depth":2},{"title":"Repository consistency","local":"repository-consistency","sections":[],"depth":2},{"title":"Reviewer assignment","local":"reviewer-assignment","sections":[],"depth":2},{"title":"Tests","local":"tests","sections":[{"title":"Test selection","local":"test-selection","sections":[],"depth":3},{"title":"Test job categories","local":"test-job-categories","sections":[],"depth":3},{"title":"Slow tests","local":"slow-tests","sections":[],"depth":3},{"title":"Model integration contracts","local":"model-integration-contracts","sections":[],"depth":3},{"title":"Documentation build","local":"documentation-build","sections":[],"depth":3}],"depth":2},{"title":"# Copied from syntax","local":"-copied-from-syntax","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/transformers/main/en/_app/immutable/entry/start.DGg0tsaB.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/fg2zYz7X.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/9fBi3yDc.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/entry/app.wXZY7RMi.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/C8DxuYff.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/DNhh5HJc.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/DOLBYqcr.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/nodes/0.DfcQe4Vu.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/CnTMS_-j.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/nodes/104.C10ax3UZ.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/en/_app/immutable/chunks/mPma6alt.js" rel="modulepreload"> | |
| <!--1ge1etd--><meta name="hf:doc:metadata" content="{"title":"Pull request checks","local":"pull-request-checks","sections":[{"title":"Fixing the CI","local":"fixing-the-ci","sections":[],"depth":2},{"title":"Code quality","local":"code-quality","sections":[],"depth":2},{"title":"Repository consistency","local":"repository-consistency","sections":[],"depth":2},{"title":"Reviewer assignment","local":"reviewer-assignment","sections":[],"depth":2},{"title":"Tests","local":"tests","sections":[{"title":"Test selection","local":"test-selection","sections":[],"depth":3},{"title":"Test job categories","local":"test-job-categories","sections":[],"depth":3},{"title":"Slow tests","local":"slow-tests","sections":[],"depth":3},{"title":"Model integration contracts","local":"model-integration-contracts","sections":[],"depth":3},{"title":"Documentation build","local":"documentation-build","sections":[],"depth":3}],"depth":2},{"title":"# Copied from syntax","local":"-copied-from-syntax","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/transformers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="pull-request-checks" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pull-request-checks"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Pull request checks<!----></span></h1><!--]--><!----> <p>When you open a pull request, the Hugging Face CI runs several checks that must pass before your PR can be merged.</p> <ul><li><a href="#fixing-the-ci">Fixing the CI</a> lists the commands to run locally to pass the checks.</li> <li>The sections after that describe what each check validates, such as <a href="#code-quality">code quality</a> and <a href="#repository-consistency">repository consistency</a>.</li> <li><a href="#tests">Tests</a> describe which tests are run, test categories, and slow tests.</li></ul> <!--[1--><h2 class="relative group"><a id="fixing-the-ci" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#fixing-the-ci"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Fixing the CI<!----></span></h2><!--]--><!----> <p>In most cases, <code>make style</code> is enough to clear the code quality check, which is the most common failure.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->make style<!----></pre></div><!----> <p>For failures in repository consistency, copies, or auto-generated files, run <code>make fix-repo</code>. It fixes style, copies, docstrings, and auto-generated files in one pass.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->make fix-repo<!----></pre></div><!----> <p>For a larger change, the three-command sequence below covers every check. It is heavier, but catches everything before you push.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->make fix-repo <span class="hljs-comment"># auto-fix everything that can be auto-fixed</span> | |
| make typing <span class="hljs-comment"># check types and model structure, fix any errors manually</span> | |
| make check-repo <span class="hljs-comment"># verify all checks pass, fix anything that remains</span><!----></pre></div><!----> <p><code>make typing</code> catches type errors and model structure violations that you fix manually. <code>make check-repo</code> does a final read-only pass so you can confirm everything is ready.</p> <blockquote class="note"><p>The CI is occasionally flaky. If a check fails on something unrelated to your change, ping a maintainer to re-run it.</p></blockquote> <!--[1--><h2 class="relative group"><a id="code-quality" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#code-quality"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Code quality<!----></span></h2><!--]--><!----> <p>The code quality check covers formatting, imports, type checking, and model structure rules. It corresponds to <code>make fix-repo</code> and <code>make typing</code>.</p> <p><code>make style</code> (included in <code>make fix-repo</code>) auto-fixes <a href="https://docs.astral.sh/ruff/" rel="nofollow">Ruff</a> linting and formatting, <code>__init__.py</code> import sort order, and auto-mapping consistency.</p> <p><code>make typing</code> performs type checking with <a href="https://docs.astral.sh/ty/" rel="nofollow">ty</a> and validates TRansFormers (TRF) rules, which cover config class naming conventions and <code>forward()</code> signatures. Type errors and TRF violations report a specific rule number and must be fixed manually. The rules live in the <a href="https://github.com/huggingface/transformers-mlinter" rel="nofollow">mlinter</a> repository. Run <code>python -m utils.mlinter --list-rules</code> to see every TRF rule, or <code>python -m utils.mlinter --rule TRFXXX</code> to view the full documentation for a specific rule.</p> <p>If a TRF rule needs an exception, choose one of these options (see <a href="./modeling_rules#suppressing-violations">Suppressing violations</a> for more details).</p> <ul><li>Add your model name to the <code>allowlist_models</code> list for the relevant rule in <code>utils/mlinter/rules.toml</code>. Use this when the whole model file needs an exception.</li> <li>Add <code># trf-ignore: TRFXXX</code> on the same line as the flagged construct, or on the line immediately above it. Use this when only one flagged construct needs an exception.</li></ul> <!--[1--><h2 class="relative group"><a id="repository-consistency" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#repository-consistency"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Repository consistency<!----></span></h2><!--]--><!----> <p>The repository consistency check is similar to <code>make check-repo</code>, except it stops on the first failure. It keeps the repository internally consistent across the categories below: public objects stay importable, copied code stays in sync with its source, and auto-generated files (dummies, doctests, metadata) reflect the current state of the code. For new models, it also verifies every new model class is registered in the auto-mappings.</p> <table><thead><tr><th>Category</th><th>What it validates</th><th>Auto-fixed?</th></tr></thead><tbody><tr><td>Init files</td><td><code>__init__.py</code> files in <code>src/transformers/models/</code> are up to date</td><td><code>make fix-repo</code></td></tr><tr><td>Copies and modular</td><td><code># Copied from</code> blocks match their source and modular-generated files are up to date</td><td><code>make fix-repo</code></td></tr><tr><td>Docstrings and docs</td><td>Argument docstrings match function signatures and documentation table of contents</td><td><code>make fix-repo</code></td></tr><tr><td>Auto-generated files</td><td>Dummies, pipeline typing, doctest list, metadata, dependency table</td><td><code>make fix-repo</code></td></tr><tr><td>Config validation</td><td>Config classes have valid checkpoints in docstrings and config attributes match modeling file</td><td>Manual</td></tr><tr><td>Reviewer assignment</td><td>Every model directory, and every rule in the reviewer file, still reaches a reviewer</td><td>Manual</td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="reviewer-assignment" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reviewer-assignment"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Reviewer assignment<!----></span></h2><!--]--><!----> <p><code>.github/scripts/codeowners_for_review_action</code> records who reviews which files.</p> <p>Ownership is resolved per file, most specific first.</p> <table><thead><tr><th>Where</th><th>Looks like</th><th>Use it for</th></tr></thead><tbody><tr><td>The model file</td><td><code># Reviewers: @login</code> in the leading comment block of <code>modular_<model>.py</code> or <code>modeling_<model>.py</code></td><td>a model that needs someone other than its modality owner. The modular converter copies the header into the generated modeling file, so the tag survives regeneration</td></tr><tr><td>A path rule</td><td><code>/src/transformers/<area>/ @login</code> in <code>.github/scripts/codeowners_for_review_action</code></td><td>anything that is not a model</td></tr><tr><td>The modality table</td><td><code>@@modality/vision @login</code>, in the same file</td><td>every model whose doc page sits in that section of <code>docs/source/en/_toctree.yml</code></td></tr><tr><td>The catch-all</td><td><code>* @Rocketknight1 @ArthurZucker</code></td><td>whatever nothing else claims</td></tr></tbody></table> <p>A new model needs no entry anywhere: adding its documentation page to <code>_toctree.yml</code>, which the documentation table of contents check already requires, places it in a modality, and the modality table covers it from there.</p> <p><code>make check-repository-consistency</code> runs <code>utils/check_reviewers.py</code>, which fails when a model reaches nobody but the catch-all, when a rule matches no file any more, or when the modality table disagrees with the table of contents. Its resolver is not a dependency of <code>transformers</code>; it is listed in <code>utils/checkers-requirements.txt</code>, which the checker runner installs on its first run in an environment. If the install cannot happen — offline, say — the check reports it and passes rather than blocking you. | |
| Paths outside <code>src/transformers/models</code> that have no owner are reported as a note; list them with:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->python utils/check_reviewers.py --strict<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="tests" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tests"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Tests<!----></span></h2><!--]--><!----> <p>CI runs a targeted subset of tests based on what your PR changes. The CI runs tests in a slightly randomized order with <a href="https://github.com/jbasko/pytest-random-order" rel="nofollow">pytest-random-order</a> to catch coupled tests. The run prints the random seed at the start so you can replay the same order with <code>--random-order-seed=<seed></code>.</p> <p>If a test passes locally on GPU but fails in CI, set <code>TRANSFORMERS_TEST_DEVICE="cpu"</code> to check whether you can reproduce the failure on CPU.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->TRANSFORMERS_TEST_DEVICE=<span class="hljs-string">"cpu"</span> pytest tests/models/my_model/ -v<!----></pre></div><!----> <p>The sections below explain how test selection works, which jobs run, and how to handle slow tests.</p> <!--[2--><h3 class="relative group"><a id="test-selection" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#test-selection"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Test selection<!----></span></h3><!--]--><!----> <p>CI doesn’t run the full test suite on every PR. CI skips tests decorated with <code>@slow</code> on every PR, and a maintainer triggers them on GPU once the PR is under review.</p> <p><code>utils/tests_fetcher.py</code> traces import dependencies from your changed files to identify affected tests, and only runs those. It also catches regressions in other models when you touch shared utilities. The fetcher prints which files changed and which tests are impacted, then writes the list to <code>tests_torch_test_list.txt</code>.</p> <p>Use the fetcher to replicate exactly what CI runs.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->python utils/tests_fetcher.py | |
| python -m pytest -n 8 --dist=loadfile -rA -s $(<span class="hljs-built_in">cat</span> test_preparation/tests_torch_test_list.txt)<!----></pre></div><!----> <blockquote class="tip"><p>Changing core files like <code>modeling_utils.py</code> or <code>generation/utils.py</code> triggers all model tests, not just the affected subset.</p></blockquote> <p>You can also run every test for your model unconditionally. A direct run is a faster local sanity check, but it won’t catch regressions in other models caused by shared code you touched.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->pytest tests/models/my_model/ -v<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="test-job-categories" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#test-job-categories"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Test job categories<!----></span></h3><!--]--><!----> <p>Tests are split across parallel CI jobs, and each job picks up files by path pattern. The relevant jobs for a model PR are:</p> <ul><li><code>tests_torch</code>: modeling tests (<code>tests/models/*/test_modeling_*.py</code>)</li> <li><code>tests_tokenization</code>: tokenizer tests (<code>tests/models/*/test_tokenization_*.py</code>)</li> <li><code>tests_processors</code>: processor and feature extractor tests (<code>tests/models/*/test_(processing|image_processing|feature_extractor)_*.py</code>)</li> <li><code>tests_generate</code>: generation tests</li> <li><code>pipelines_torch</code>: pipeline tests</li> <li><code>tests_training_ci</code>: training loop tests</li> <li><code>tests_tensor_parallel_ci</code>: tensor parallel tests</li> <li><code>tests_fsdp_ci</code>: FSDP tests</li></ul> <!--[2--><h3 class="relative group"><a id="slow-tests" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#slow-tests"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Slow tests<!----></span></h3><!--]--><!----> <p>Regular CI runs skip tests decorated with <code>@slow</code>. They download real checkpoints or need significant compute, so they run on GPU instances, and maintainers trigger them once your PR is under review.</p> <p>Slow tests run on an NVIDIA A10, and numerical results can vary slightly between the CI hardware and your local machine. Maintainers usually adjusts those values on tests if needed when adding a new model.</p> <p>Run slow tests locally with the command below.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->RUN_SLOW=1 python -m pytest tests/models/my_model/ -v<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="model-integration-contracts" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#model-integration-contracts"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Model integration contracts<!----></span></h3><!--]--><!----> <p>Model integration contracts (MICs) run the documented usage code of published models on small fixtures and compare the outputs with reviewed expected values, the baselines. The <code>fast-integration / transformers</code> job runs the contracts your changes select (see <a href="./testing#run-model-integration-contracts-locally">Run Model Integration Contracts locally</a>), and its summary lists every red case.</p> <p>A red case is <strong>blocked</strong> when it is green on the PR’s base and red on the PR, so the PR caused it. Any other red case is a warning that isn’t yours to fix: <code>main</code> is already red, a setup error (a missing baseline, fixture drift), or a known failure that now passes. The job doesn’t fail the PR yet, but a blocked case must be resolved before merge. A bot comment on the PR lists the blocked cases with links to the contracts run, and is marked resolved once nothing is blocked.</p> <p>For a blocked case, decide whether the new output is a regression or an intended change.</p> <ul><li><p><strong>Regression</strong>: fix it in your PR. Reproduce it locally with <code>make run-mic MODEL=<model></code>.</p></li> <li><p><strong>Intended change</strong> (a bug fix, a new default, a different but correct kernel): update the baselines for your PR. Push your final changes and let the contracts job finish, because the new values come from the PR’s latest contracts run. Then someone with write access to the repository comments on the PR, with the models to update on the first line:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-text "><!---->record-mic: gptj codegen<!----></pre></div><!----> <p>or runs <code>make record-mic MODEL="gptj codegen"</code> from a checkout of the branch (add <code>PR=<number></code> when the branch has no PR). Models can be named by model type (<code>gptj</code>), contract or target. A bot replies on the PR with the values to review, and the PR’s next contracts run uses them.</p></li></ul> <p>The new values apply to your PR only until it merges. From the merge commit on, every run uses them: later PRs, <code>main</code>, and reruns of later commits. A run of an older commit keeps the old values, so your change doesn’t turn it red. Nothing needs updating after the merge. <code>make run-mic</code> is the exception: it checks against the fleet pinned in <code>tests/contracts.lock</code> and doesn’t apply recorded values, so the re-recorded cases stay red locally until that pin is updated.</p> <p>When recording isn’t possible, a maintainer who reviewed the change as intended can add the <code>mic-intended-change</code> label instead. Blocked cases then only warn, and the baselines have to be updated separately or <code>main</code> turns red after the merge.</p> <p>A PR labeled <code>New model</code> never blocks on contracts: its red cases are warnings.</p> <!--[2--><h3 class="relative group"><a id="documentation-build" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#documentation-build"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Documentation build<!----></span></h3><!--]--><!----> <p>A <code>build_pr_documentation</code> job builds and generates a preview of the documentation. A bot posts a preview link in your PR, and the check must pass before merging. Most failures are a missing entry in the <code>toctree</code>. To build the documentation locally, see the <a href="https://github.com/huggingface/transformers/tree/main/docs" rel="nofollow">README.md</a> in the docs folder.</p> <!--[1--><h2 class="relative group"><a id="-copied-from-syntax" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-copied-from-syntax"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!----># Copied from syntax<!----></span></h2><!--]--><!----> <blockquote class="warning"><p>For new models, always prefer the <a href="modular_transformers">modular workflow</a> (<code>modular_*.py</code>) over <code># Copied from</code>. Avoid <code># Copied from</code> whenever possible.</p></blockquote> <p>The <code># Copied from</code> mechanism keeps copied code in sync with its source. When <code>make fix-repo</code> runs, it checks every <code># Copied from</code> block and updates it to match the original, so edits inside a <code># Copied from</code> block are overwritten. Edit the source instead and let <code>make fix-repo</code> propagate the change.</p> <p>The basic forms of <code># Copied from</code> include the following.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-comment"># Copied from transformers.models.bert.modeling_bert.BertSelfOutput</span> | |
| <span class="hljs-comment"># Copied from transformers.models.bert.modeling_bert.BertAttention with Bert->Roberta</span> | |
| <span class="hljs-comment"># Copied from transformers.models.bert.modeling_bert.BertForSequenceClassification with Bert->MobileBert all-casing</span><!----></pre></div><!----> <p>The <code>with model->newModel</code> syntax applies string replacements after copying. Separate multiple replacements with commas, which are applied from left to right. The <code>all-casing</code> option replaces every casing variant at once (<code>Bert</code>, <code>bert</code>, <code>BERT</code> become <code>MobileBert</code>, <code>mobilebert</code>, <code>MOBILEBERT</code>).</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers/blob/main/docs/source/en/pr_checks.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_2c270z = { | |
| base: "/docs/transformers/main/en", | |
| assets: "/docs/transformers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/transformers/main/en/_app/immutable/entry/start.DGg0tsaB.js"), | |
| import("/docs/transformers/main/en/_app/immutable/entry/app.wXZY7RMi.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 104], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 48.5 kB
- Xet hash:
- 65bb04aad1713e2d1ef8db2c2996c9ca022190fd5e033d18eaca40bde4e2db7d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.