Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Verificările pentru pull request","local":"verificările-pentru-pull-request","sections":[{"title":"Remedierea CI-ului","local":"remedierea-ci-ului","sections":[],"depth":2},{"title":"Calitatea codului","local":"calitatea-codului","sections":[],"depth":2},{"title":"Consistența repository-ului","local":"consistența-repository-ului","sections":[],"depth":2},{"title":"Teste","local":"teste","sections":[{"title":"Selecția testelor","local":"selecția-testelor","sections":[],"depth":3},{"title":"Categoriile de job-uri de test","local":"categoriile-de-job-uri-de-test","sections":[],"depth":3},{"title":"Testele slow","local":"testele-slow","sections":[],"depth":3},{"title":"Build-ul documentației","local":"build-ul-documentației","sections":[],"depth":3}],"depth":2},{"title":"Sintaxa # Copied from","local":"sintaxa--copied-from","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/transformers/main/ro/_app/immutable/entry/start.DwnOcLC_.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/CL87Xr5_.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/Cl6kX2N0.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/entry/app.Dw7RcaNl.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/BzzeShVL.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/DWwSmaYb.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/DM0RASQS.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/nodes/0.DMmsXSdS.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/C8aKV6he.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/nodes/28.DLtcy7MO.js" rel="modulepreload"> | |
| <link href="/docs/transformers/main/ro/_app/immutable/chunks/CjTxHwdC.js" rel="modulepreload"> | |
| <!--1ge1etd--><meta name="hf:doc:metadata" content="{"title":"Verificările pentru pull request","local":"verificările-pentru-pull-request","sections":[{"title":"Remedierea CI-ului","local":"remedierea-ci-ului","sections":[],"depth":2},{"title":"Calitatea codului","local":"calitatea-codului","sections":[],"depth":2},{"title":"Consistența repository-ului","local":"consistența-repository-ului","sections":[],"depth":2},{"title":"Teste","local":"teste","sections":[{"title":"Selecția testelor","local":"selecția-testelor","sections":[],"depth":3},{"title":"Categoriile de job-uri de test","local":"categoriile-de-job-uri-de-test","sections":[],"depth":3},{"title":"Testele slow","local":"testele-slow","sections":[],"depth":3},{"title":"Build-ul documentației","local":"build-ul-documentației","sections":[],"depth":3}],"depth":2},{"title":"Sintaxa # Copied from","local":"sintaxa--copied-from","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/transformers/main/ro/_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: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div 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>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="verificările-pentru-pull-request" 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="#verificările-pentru-pull-request"><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>Verificările pentru pull request</span></h1><!--]--><!----> <p>Când deschizi un pull request, CI-ul Hugging Face rulează mai multe verificări care trebuie să treacă înainte ca PR-ul tău să poată fi integrat.</p> <ul><li><a href="#remedierea-ci-ului">Remedierea CI-ului</a> listează comenzile de rulat local ca să treci verificările.</li> <li>Secțiunile care urmează descriu ce validează fiecare verificare, cum ar fi <a href="#calitatea-codului">calitatea codului</a> și <a href="#consisten%C8%9Ba-repository-ului">consistența repository-ului</a>.</li> <li><a href="#teste">Teste</a> descrie ce teste sunt rulate, categoriile de teste și testele slow.</li></ul> <!--[1--><h2 class="relative group"><a id="remedierea-ci-ului" 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="#remedierea-ci-ului"><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>Remedierea CI-ului</span></h2><!--]--><!----> <p>În cele mai multe cazuri, <code>make style</code> este suficient pentru a trece verificarea de calitate a codului, care este cel mai comun eșec.</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>Pentru eșecuri la consistența repository-ului, copii sau fișiere auto-generate, rulează <code>make fix-repo</code>. Remediază stilul, copiile, docstring-urile și fișierele auto-generate într-o singură trecere.</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>Pentru o modificare mai mare, secvența de trei comenzi de mai jos acoperă fiecare verificare. Este mai grea, dar prinde tot înainte să dai 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-remediază tot ce poate fi auto-remediat</span> | |
| make typing <span class="hljs-comment"># verifică tipurile și structura modelului, remediază manual orice erori</span> | |
| make check-repo <span class="hljs-comment"># verifică că toate verificările trec, remediază ce mai rămâne</span><!----></pre></div><!----> <p><code>make typing</code> prinde erori de tip și violări de structură a modelului pe care le remediezi manual. <code>make check-repo</code> face o trecere finală read-only ca să confirmi că totul este pregătit.</p> <blockquote class="note"><p>CI-ul este uneori instabil. Dacă o verificare eșuează pe ceva fără legătură cu modificarea ta, contactează un maintainer ca să o reruleze.</p></blockquote> <!--[1--><h2 class="relative group"><a id="calitatea-codului" 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="#calitatea-codului"><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>Calitatea codului</span></h2><!--]--><!----> <p>Verificarea calității codului acoperă formatarea, importurile, type checking-ul și regulile de structură a modelului. Corespunde cu <code>make fix-repo</code> și <code>make typing</code>.</p> <p><code>make style</code> (inclus în <code>make fix-repo</code>) auto-remediază linting-ul și formatarea <a href="https://docs.astral.sh/ruff/" rel="nofollow">Ruff</a>, ordinea importurilor din <code>__init__.py</code> și consistența auto-mapărilor.</p> <p><code>make typing</code> efectuează type checking cu <a href="https://docs.astral.sh/ty/" rel="nofollow">ty</a> și validează regulile TRansFormers (TRF), care acoperă convențiile de denumire ale claselor de config și semnăturile <code>forward()</code>. Erorile de tip și violările TRF raportează un număr de regulă specific și trebuie remediate manual. Regulile se găsesc în repository-ul <a href="https://github.com/huggingface/transformers-mlinter" rel="nofollow">mlinter</a>. Rulează <code>python -m utils.mlinter --list-rules</code> ca să vezi fiecare regulă TRF, sau <code>python -m utils.mlinter --rule TRFXXX</code> ca să vezi documentația completă pentru o regulă specifică.</p> <p>Dacă o regulă TRF necesită o excepție, alege una din aceste opțiuni (vezi <a href="./modeling_rules#suprimarea-viol%C4%83rilor">Suprimarea violărilor</a> pentru mai multe detalii).</p> <ul><li>Adaugă numele modelului tău în lista <code>allowlist_models</code> pentru regula relevantă din <code>utils/mlinter/rules.toml</code>. Folosește asta când întregul fișier de model necesită o excepție.</li> <li>Adaugă <code># trf-ignore: TRFXXX</code> pe aceeași linie cu construcția semnalată, sau pe linia imediat de deasupra. Folosește asta când doar o construcție semnalată necesită o excepție.</li></ul> <!--[1--><h2 class="relative group"><a id="consistența-repository-ului" 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="#consistența-repository-ului"><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>Consistența repository-ului</span></h2><!--]--><!----> <p>Verificarea consistenței repository-ului este similară cu <code>make check-repo</code>, cu excepția că se oprește la primul eșec. Menține repository-ul intern consistent în categoriile de mai jos: obiectele publice rămân importabile, codul copiat rămâne sincronizat cu sursa sa, iar fișierele auto-generate (dummy-uri, doctests, metadate) reflectă starea curentă a codului. Pentru modelele noi, verifică și că fiecare clasă de model nouă este înregistrată în auto-mapări.</p> <table><thead><tr><th>Categorie</th><th>Ce validează</th><th>Auto-remediat?</th></tr></thead><tbody><tr><td>Fișiere init</td><td>Fiecare obiect public nou trebuie să apară atât în <code>_import_structure</code> (lazy loading), cât și în blocul <code>if TYPE_CHECKING</code> (importuri pentru type checker) din <code>__init__.py</code></td><td>Manual</td></tr><tr><td>Copii și modular</td><td>Blocurile <code># Copied from</code> corespund sursei lor și fișierele generate din modular sunt actualizate</td><td><code>make fix-repo</code></td></tr><tr><td>Docstring-uri și docs</td><td>Docstring-urile argumentelor corespund semnăturilor funcțiilor și cuprinsului documentației</td><td><code>make fix-repo</code></td></tr><tr><td>Fișiere auto-generate</td><td>Dummy-uri, pipeline typing, lista doctest, metadate, tabel de dependențe</td><td><code>make fix-repo</code></td></tr><tr><td>Validarea config</td><td>Clasele de config au checkpoint-uri valide în docstring-uri și atributele de config corespund fișierului de modelare</td><td>Manual</td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="teste" 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="#teste"><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>Teste</span></h2><!--]--><!----> <p>CI rulează un subset țintit de teste bazat pe ce modifică PR-ul tău. CI rulează testele într-o ordine ușor randomizată cu <a href="https://github.com/jbasko/pytest-random-order" rel="nofollow">pytest-random-order</a> ca să prindă testele cuplate. Rularea printează seed-ul random la început ca să poți repeta aceeași ordine cu <code>--random-order-seed=<seed></code>.</p> <p>Dacă un test trece local pe GPU, dar eșuează în CI, setează <code>TRANSFORMERS_TEST_DEVICE="cpu"</code> ca să verifici dacă poți reproduce eșecul pe 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>Secțiunile de mai jos explică cum funcționează selecția testelor, ce job-uri rulează și cum să gestionezi testele slow.</p> <!--[2--><h3 class="relative group"><a id="selecția-testelor" 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="#selecția-testelor"><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>Selecția testelor</span></h3><!--]--><!----> <p>CI nu rulează suita completă de teste la fiecare PR. CI sare peste testele decorate cu <code>@slow</code> la fiecare PR, iar un maintainer le declanșează pe GPU odată ce PR-ul este în review.</p> <p><code>utils/tests_fetcher.py</code> urmărește dependențele de import din fișierele tale modificate ca să identifice testele afectate și le rulează doar pe acelea. Prinde și regresiile în alte modele când atingi utilitare partajate. Fetcher-ul printează ce fișiere s-au modificat și ce teste sunt impactate, apoi scrie lista în <code>tests_torch_test_list.txt</code>.</p> <p>Folosește fetcher-ul ca să replici exact ce rulează CI.</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>Modificarea fișierelor de bază precum <code>modeling_utils.py</code> sau <code>generation/utils.py</code> declanșează toate testele de model, nu doar subsetul afectat.</p></blockquote> <p>Poți și să rulezi fiecare test pentru modelul tău necondiționat. O rulare directă este o verificare locală mai rapidă, dar nu va prinde regresiile în alte modele cauzate de cod partajat pe care l-ai atins.</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="categoriile-de-job-uri-de-test" 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="#categoriile-de-job-uri-de-test"><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>Categoriile de job-uri de test</span></h3><!--]--><!----> <p>Testele sunt împărțite pe job-uri CI paralele, iar fiecare job preia fișiere după pattern de cale. Job-urile relevante pentru un PR de model sunt:</p> <ul><li><code>tests_torch</code>: teste de modelare (<code>tests/models/*/test_modeling_*.py</code>)</li> <li><code>tests_tokenization</code>: teste pentru tokenizer (<code>tests/models/*/test_tokenization_*.py</code>)</li> <li><code>tests_processors</code>: teste pentru procesatoare și feature extractors (<code>tests/models/*/test_(processing|image_processing|feature_extractor)_*.py</code>)</li> <li><code>tests_generate</code>: teste de generare</li> <li><code>pipelines_torch</code>: teste de pipeline</li> <li><code>tests_training_ci</code>: teste pentru loop-ul de antrenare</li> <li><code>tests_tensor_parallel_ci</code>: teste de tensor parallelism</li></ul> <!--[2--><h3 class="relative group"><a id="testele-slow" 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="#testele-slow"><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>Testele slow</span></h3><!--]--><!----> <p>Rulările regulate CI sar peste testele decorate cu <code>@slow</code>. Acestea descarcă checkpoint-uri reale sau necesită resurse de calcul semnificative, deci rulează pe instanțe GPU, iar maintainerii le declanșează odată ce PR-ul tău este în review.</p> <p>Testele slow rulează pe un NVIDIA A10, iar rezultatele numerice pot varia ușor între hardware-ul CI și mașina ta locală. Maintainerii ajustează de obicei acele valori în teste dacă e necesar când se adaugă un model nou.</p> <p>Rulează testele slow local cu comanda de mai jos.</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="build-ul-documentației" 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="#build-ul-documentației"><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>Build-ul documentației</span></h3><!--]--><!----> <p>Un job <code>build_pr_documentation</code> construiește și generează un preview al documentației. Un bot postează un link de preview în PR-ul tău, iar verificarea trebuie să treacă înainte de integrare. Cele mai multe eșecuri sunt o intrare lipsă în <code>toctree</code>. Ca să construiești documentația local, vezi <a href="https://github.com/huggingface/transformers/tree/main/docs" rel="nofollow">README.md</a> din folder-ul docs.</p> <!--[1--><h2 class="relative group"><a id="sintaxa--copied-from" 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="#sintaxa--copied-from"><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>Sintaxa # Copied from</span></h2><!--]--><!----> <blockquote class="warning"><p>Pentru modele noi, preferă întotdeauna <a href="modular_transformers">workflow-ul modular</a> (<code>modular_*.py</code>) față de <code># Copied from</code>. Evită <code># Copied from</code> ori de câte ori e posibil.</p></blockquote> <p>Mecanismul <code># Copied from</code> menține codul copiat sincronizat cu sursa sa. Când <code>make fix-repo</code> rulează, verifică fiecare bloc <code># Copied from</code> și îl actualizează să corespundă originalului, deci editările din interiorul unui bloc <code># Copied from</code> sunt suprascrise. Editează sursa în schimb și lasă <code>make fix-repo</code> să propage modificarea.</p> <p>Formele de bază ale <code># Copied from</code> includ următoarele.</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>Sintaxa <code>with model->newModel</code> aplică înlocuiri de string-uri după copiere. Separă înlocuirile multiple cu virgule, aplicate de la stânga la dreapta. Opțiunea <code>all-casing</code> înlocuiește toate variantele de scriere deodată (<code>Bert</code>, <code>bert</code>, <code>BERT</code> devin <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/ro/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_10j3czc = { | |
| base: "/docs/transformers/main/ro", | |
| assets: "/docs/transformers/main/ro" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/transformers/main/ro/_app/immutable/entry/start.DwnOcLC_.js"), | |
| import("/docs/transformers/main/ro/_app/immutable/entry/app.Dw7RcaNl.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 28], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 39.4 kB
- Xet hash:
- 2ebc203156b65181cd55dfaef488bf4632a63308c6dbb13f14e942e9328d96fd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.