Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Cum să ceri ajutor pe forumuri","local":"cum-sa-ceri-ajutor-pe-forumuri","sections":[{"title":"Scrierea unei postări bune pe forum","local":"scrierea-unei-postari-bune-pe-forum","sections":[{"title":"Alegerea unui titlu descriptiv","local":"alegerea-unui-titlu-descriptiv","sections":[],"depth":3},{"title":"Formatarea fragmentelor de cod","local":"formatarea-fragmentelor-de-cod","sections":[],"depth":3},{"title":"Includerea traceback-ului complet","local":"includerea-traceback-ului-complet","sections":[],"depth":3},{"title":"Furnizarea unui exemplu reproductibil","local":"furnizarea-unui-exemplu-reproductibil","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/course/pr_1069/rum/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/entry/start.1de7c3d2.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/scheduler.37c15a92.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/singletons.e13b7dfd.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/index.18351ede.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/paths.e130b7b0.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/entry/app.1f82014c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/index.2bf4358c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/nodes/0.3c83e1ab.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/nodes/87.a3d360f7.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/Youtube.1e50a667.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/CodeBlock.4e987730.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/CourseFloatingBanner.6add7356.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/rum/_app/immutable/chunks/getInferenceSnippets.24b50994.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Cum să ceri ajutor pe forumuri","local":"cum-sa-ceri-ajutor-pe-forumuri","sections":[{"title":"Scrierea unei postări bune pe forum","local":"scrierea-unei-postari-bune-pe-forum","sections":[{"title":"Alegerea unui titlu descriptiv","local":"alegerea-unui-titlu-descriptiv","sections":[],"depth":3},{"title":"Formatarea fragmentelor de cod","local":"formatarea-fragmentelor-de-cod","sections":[],"depth":3},{"title":"Includerea traceback-ului complet","local":"includerea-traceback-ului-complet","sections":[],"depth":3},{"title":"Furnizarea unui exemplu reproductibil","local":"furnizarea-unui-exemplu-reproductibil","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="cum-sa-ceri-ajutor-pe-forumuri" 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="#cum-sa-ceri-ajutor-pe-forumuri"><span><svg class="" 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>Cum să ceri ajutor pe forumuri</span></h1> <div class="flex space-x-1 absolute z-10 right-0 top-0"><a href="https://discuss.huggingface.co/t/chapter-8-questions" target="_blank"><img alt="Ask a Question" class="!m-0" src="https://img.shields.io/badge/Ask%20a%20question-ffcb4c.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgLTEgMTA0IDEwNiI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiMyMzFmMjA7fS5jbHMtMntmaWxsOiNmZmY5YWU7fS5jbHMtM3tmaWxsOiMwMGFlZWY7fS5jbHMtNHtmaWxsOiMwMGE5NGY7fS5jbHMtNXtmaWxsOiNmMTVkMjI7fS5jbHMtNntmaWxsOiNlMzFiMjM7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5EaXNjb3Vyc2VfbG9nbzwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiPjxnIGlkPSJMYXllcl8zIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik01MS44NywwQzIzLjcxLDAsMCwyMi44MywwLDUxYzAsLjkxLDAsNTIuODEsMCw1Mi44MWw1MS44Ni0uMDVjMjguMTYsMCw1MS0yMy43MSw1MS01MS44N1M4MCwwLDUxLjg3LDBaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNNTIuMzcsMTkuNzRBMzEuNjIsMzEuNjIsMCwwLDAsMjQuNTgsNjYuNDFsLTUuNzIsMTguNEwzOS40LDgwLjE3YTMxLjYxLDMxLjYxLDAsMSwwLDEzLTYwLjQzWiIvPjxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTc3LjQ1LDMyLjEyYTMxLjYsMzEuNiwwLDAsMS0zOC4wNSw0OEwxOC44Niw4NC44MmwyMC45MS0yLjQ3QTMxLjYsMzEuNiwwLDAsMCw3Ny40NSwzMi4xMloiLz48cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Ik03MS42MywyNi4yOUEzMS42LDMxLjYsMCwwLDEsMzguOCw3OEwxOC44Niw4NC44MiwzOS40LDgwLjE3QTMxLjYsMzEuNiwwLDAsMCw3MS42MywyNi4yOVoiLz48cGF0aCBjbGFzcz0iY2xzLTUiIGQ9Ik0yNi40Nyw2Ny4xMWEzMS42MSwzMS42MSwwLDAsMSw1MS0zNUEzMS42MSwzMS42MSwwLDAsMCwyNC41OCw2Ni40MWwtNS43MiwxOC40WiIvPjxwYXRoIGNsYXNzPSJjbHMtNiIgZD0iTTI0LjU4LDY2LjQxQTMxLjYxLDMxLjYxLDAsMCwxLDcxLjYzLDI2LjI5YTMxLjYxLDMxLjYxLDAsMCwwLTQ5LDM5LjYzbC0zLjc2LDE4LjlaIi8+PC9nPjwvZz48L3N2Zz4="></a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter8/section3.ipynb" target="_blank"><img alt="Open In Colab" class="!m-0" src="https://colab.research.google.com/assets/colab-badge.svg"></a> <a href="https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter8/section3.ipynb" target="_blank"><img alt="Open In Studio Lab" class="!m-0" src="https://studiolab.sagemaker.aws/studiolab.svg"></a></div> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/S2EEG3JIt2A" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-1glsx2x"><a href="https://discuss.huggingface.co" rel="nofollow">Forumurile Hugging Face</a> sunt un loc excelent pentru a obține ajutor de la echipa open source și comunitatea mai largă Hugging Face. Iată cum arată pagina principală într-o zi obișnuită:</p> <div class="flex justify-center" data-svelte-h="svelte-wyj486"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forums.png" alt="Forumurile Hugging Face." width="100%"></div> <p data-svelte-h="svelte-g6sg1z">În partea stângă puteți vedea toate categoriile în care sunt grupate diversele subiecte, în timp ce partea dreaptă arată subiectele cele mai recente. Un subiect este o postare care conține un titlu, o categorie și o descriere; este destul de similar cu formatul GitHub issues pe care l-am văzut când am creat propriul nostru set de date în <a href="/course/chapter5">Capitolul 5</a>. Așa cum sugerează numele, categoria <a href="https://discuss.huggingface.co/c/beginners/5" rel="nofollow">Beginners</a> este destinată în principal persoanelor care abia încep cu bibliotecile și ecosistemul Hugging Face. Orice întrebare despre oricare dintre biblioteci este binevenită acolo, fie pentru a depana cod sau pentru a cere ajutor despre cum să faci ceva. (Totuși, dacă întrebarea ta se referă la o bibliotecă în particular, probabil ar trebui să mergi la categoria corespunzătoare a bibliotecii pe forum.)</p> <p data-svelte-h="svelte-2pe7mg">În mod similar, categoriile <a href="https://discuss.huggingface.co/c/intermediate/6" rel="nofollow">Intermediate</a> și <a href="https://discuss.huggingface.co/c/research/7" rel="nofollow">Research</a> sunt pentru întrebări mai avansate, de exemplu despre biblioteci sau despre cercetări NLP noi și interesante pe care ați dori să le discutați.</p> <p data-svelte-h="svelte-kbl7jg">Și, în mod natural, ar trebui să menționăm și categoria <a href="https://discuss.huggingface.co/c/course/20" rel="nofollow">Course</a>, unde puteți pune orice întrebări aveți care sunt legate de cursul Hugging Face!</p> <p data-svelte-h="svelte-1be6kzk">Odată ce ați selectat o categorie, veți fi gata să scrieți primul vostru subiect. Puteți găsi câteva <a href="https://discuss.huggingface.co/t/how-to-request-support/3128" rel="nofollow">ghiduri</a> pe forum despre cum să faceți acest lucru, și în această secțiune vom arunca o privire asupra unor caracteristici care alcătuiesc un subiect bun.</p> <h2 class="relative group"><a id="scrierea-unei-postari-bune-pe-forum" 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="#scrierea-unei-postari-bune-pe-forum"><span><svg class="" 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>Scrierea unei postări bune pe forum</span></h2> <p data-svelte-h="svelte-mgklem">Ca exemplu în curs de desfășurare, să presupunem că încercăm să generăm embeddings din articole Wikipedia pentru a crea un motor de căutare personalizat. Ca de obicei, încărcăm tokenizer-ul și modelul după cum urmează:</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 class="" 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=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel | |
| model_checkpoint = <span class="hljs-string">"distilbert-base-uncased"</span> | |
| tokenizer = AutoTokenizer.from_pretrained(model_checkpoint) | |
| model = AutoModel.from_pretrained(model_checkpoint)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-9ci7f">Acum să presupunem că încercăm să încorporăm o întreagă secțiune din <a href="https://en.wikipedia.org/wiki/Transformers" rel="nofollow">articolul Wikipedia</a> despre Transformers (franciza, nu biblioteca!):</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 class="" 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=""><!-- HTML_TAG_START -->text = <span class="hljs-string">""" | |
| Generation One is a retroactive term for the Transformers characters that | |
| appeared between 1984 and 1993. The Transformers began with the 1980s Japanese | |
| toy lines Micro Change and Diaclone. They presented robots able to transform | |
| into everyday vehicles, electronic items or weapons. Hasbro bought the Micro | |
| Change and Diaclone toys, and partnered with Takara. Marvel Comics was hired by | |
| Hasbro to create the backstory; editor-in-chief Jim Shooter wrote an overall | |
| story, and gave the task of creating the characthers to writer Dennis O'Neil. | |
| Unhappy with O'Neil's work (although O'Neil created the name "Optimus Prime"), | |
| Shooter chose Bob Budiansky to create the characters. | |
| The Transformers mecha were largely designed by Shōji Kawamori, the creator of | |
| the Japanese mecha anime franchise Macross (which was adapted into the Robotech | |
| franchise in North America). Kawamori came up with the idea of transforming | |
| mechs while working on the Diaclone and Macross franchises in the early 1980s | |
| (such as the VF-1 Valkyrie in Macross and Robotech), with his Diaclone mechs | |
| later providing the basis for Transformers. | |
| The primary concept of Generation One is that the heroic Optimus Prime, the | |
| villainous Megatron, and their finest soldiers crash land on pre-historic Earth | |
| in the Ark and the Nemesis before awakening in 1985, Cybertron hurtling through | |
| the Neutral zone as an effect of the war. The Marvel comic was originally part | |
| of the main Marvel Universe, with appearances from Spider-Man and Nick Fury, | |
| plus some cameos, as well as a visit to the Savage Land. | |
| The Transformers TV series began around the same time. Produced by Sunbow | |
| Productions and Marvel Productions, later Hasbro Productions, from the start it | |
| contradicted Budiansky's backstories. The TV series shows the Autobots looking | |
| for new energy sources, and crash landing as the Decepticons attack. Marvel | |
| interpreted the Autobots as destroying a rogue asteroid approaching Cybertron. | |
| Shockwave is loyal to Megatron in the TV series, keeping Cybertron in a | |
| stalemate during his absence, but in the comic book he attempts to take command | |
| of the Decepticons. The TV series would also differ wildly from the origins | |
| Budiansky had created for the Dinobots, the Decepticon turned Autobot Jetfire | |
| (known as Skyfire on TV), the Constructicons (who combine to form | |
| Devastator),[19][20] and Omega Supreme. The Marvel comic establishes early on | |
| that Prime wields the Creation Matrix, which gives life to machines. In the | |
| second season, the two-part episode The Key to Vector Sigma introduced the | |
| ancient Vector Sigma computer, which served the same original purpose as the | |
| Creation Matrix (giving life to Transformers), and its guardian Alpha Trion. | |
| """</span> | |
| inputs = tokenizer(text, return_tensors=<span class="hljs-string">"pt"</span>) | |
| logits = model(**inputs).logits<!-- HTML_TAG_END --></pre></div> <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 class="" 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=""><!-- HTML_TAG_START -->IndexError: index out of <span class="hljs-built_in">range</span> <span class="hljs-keyword">in</span> self<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-13m13d6">Uh-oh, am întâmpinat o problemă — și mesajul de eroare este mult mai criptic decât cele pe care le-am văzut în <a href="/course/chapter8/section2">secțiunea 2</a>! Nu putem înțelege nimic din traceback-ul complet, așa că decidem să ne îndreptăm către forumurile Hugging Face pentru ajutor. Cum am putea să formulăm subiectul?</p> <p data-svelte-h="svelte-bsxph7">Pentru a începe, trebuie să facem clic pe butonul “New Topic” din colțul din dreapta sus (rețineți că pentru a crea un subiect, va trebui să fim conectați):</p> <div class="flex justify-center" data-svelte-h="svelte-1cdu47i"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forums-new-topic.png" alt="Crearea unui nou subiect pe forum." width="100%"></div> <p data-svelte-h="svelte-7d9l7j">Aceasta deschide o interfață de scriere unde putem introduce titlul subiectului nostru, să selectăm o categorie și să redactăm conținutul:</p> <div class="flex justify-center" data-svelte-h="svelte-1ercepo"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic01.png" alt="Interfața pentru crearea unui subiect pe forum." width="100%"></div> <p data-svelte-h="svelte-pn64rj">Deoarece eroarea pare să fie exclusiv despre 🤗 Transformers, vom selecta aceasta pentru categorie. Prima noastră încercare de a explica problema ar putea arăta cam așa:</p> <div class="flex justify-center" data-svelte-h="svelte-152gj8t"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic02.png" alt="Redactarea conținutului pentru un nou subiect pe forum." width="100%"></div> <p data-svelte-h="svelte-ge1sz1">Deși acest subiect conține mesajul de eroare cu care avem nevoie de ajutor, există câteva probleme cu modul în care este scris:</p> <ol data-svelte-h="svelte-17mkwtb"><li>Titlul nu este foarte descriptiv, așa că oricine navighează pe forum nu va putea să spună despre ce este subiectul fără să citească și conținutul.</li> <li>Corpul nu oferă suficiente informații despre <em>de unde</em> vine eroarea și <em>cum</em> să o reproduci.</li> <li>Subiectul etichetează câteva persoane direct cu un ton oarecum exigent.</li></ol> <p data-svelte-h="svelte-s1wdi6">Subiecte ca acesta probabil nu vor primi un răspuns rapid (dacă primesc unul deloc), așa că să vedem cum îl putem îmbunătăți. Vom începe cu prima problemă de a alege un titlu bun.</p> <h3 class="relative group"><a id="alegerea-unui-titlu-descriptiv" 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="#alegerea-unui-titlu-descriptiv"><span><svg class="" 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>Alegerea unui titlu descriptiv</span></h3> <p data-svelte-h="svelte-1d7dm0l">Dacă încercați să obțineți ajutor cu o eroare în codul vostru, o regulă bună este să includeți suficiente informații în titlu astfel încât alții să poată determina rapid dacă cred că pot răspunde la întrebarea voastră sau nu. În exemplul nostru în curs de desfășurare, știm numele excepției care este ridicată și avem câteva indicii că este declanșată în forward pass-ul modelului, unde apelăm <code>model(**inputs)</code>. Pentru a comunica aceasta, un titlu posibil ar putea fi:</p> <blockquote data-svelte-h="svelte-1m3a2ka"><p>Sursa IndexError în forward pass-ul AutoModel?</p></blockquote> <p data-svelte-h="svelte-1ld8dyu">Acest titlu îi spune cititorului <em>de unde</em> credeți că vine eroarea, și dacă au întâlnit un <code>IndexError</code> înainte, există o șansă bună că vor ști cum să îl depaneze. Desigur, titlul poate fi orice doriți, și alte variații precum:</p> <blockquote data-svelte-h="svelte-av9a7b"><p>De ce modelul meu produce un IndexError?</p></blockquote> <p data-svelte-h="svelte-1l2kv2t">ar putea fi de asemenea bune. Acum că avem un titlu descriptiv, să ne uităm la îmbunătățirea corpului.</p> <h3 class="relative group"><a id="formatarea-fragmentelor-de-cod" 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="#formatarea-fragmentelor-de-cod"><span><svg class="" 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>Formatarea fragmentelor de cod</span></h3> <p data-svelte-h="svelte-79623v">Citirea codului sursă este destul de grea într-un IDE, dar este și mai grea când codul este copiat și lipit ca text simplu! Din fericire, forumurile Hugging Face suportă utilizarea Markdown, așa că ar trebui să înconjurați întotdeauna blocurile de cod cu trei backtick-uri (```) astfel încât să fie mai ușor de citit. Să facem aceasta pentru a înfrumuseța mesajul de eroare — și în timp ce suntem la asta, să facem corpul puțin mai politicos decât versiunea noastră originală:</p> <div class="flex justify-center" data-svelte-h="svelte-1ei6l68"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic03.png" alt="Subiectul nostru revizuit pe forum, cu formatarea corectă a codului." width="100%"></div> <p data-svelte-h="svelte-1gr7qxs">Așa cum puteți vedea în captură, înconjurarea blocurilor de cod în backtick-uri transformă textul brut în cod formatat, complet cu stilizare color! De asemenea, rețineți că backtick-urile simple pot fi folosite pentru a formata variabile inline, așa cum am făcut pentru <code>distilbert-base-uncased</code>. Acest subiect arată mult mai bine, și cu puțin noroc am putea găsi pe cineva în comunitate care poate ghici despre ce este eroarea. Cu toate acestea, în loc să ne bazăm pe noroc, să facem viața mai ușoară prin includerea traceback-ului în toată splendoarea sa!</p> <h3 class="relative group"><a id="includerea-traceback-ului-complet" 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="#includerea-traceback-ului-complet"><span><svg class="" 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>Includerea traceback-ului complet</span></h3> <p data-svelte-h="svelte-1nz0743">Deoarece ultima linie a traceback-ului este adesea suficientă pentru a vă depana propriul cod, poate fi tentant să furnizați doar aceea în subiectul vostru pentru a “economisi spațiu”. Deși este bine intenționat, aceasta de fapt face <em>mai greu</em> pentru alții să depaneze problema deoarece informațiile care sunt mai sus în traceback pot fi de asemenea foarte utile. Deci, o practică bună este să copiați și să lipiți <em>întregul</em> traceback, asigurându-vă că este frumos formatat. Deoarece aceste traceback-uri pot deveni destul de lungi, unii oameni preferă să le arate după ce au explicat codul sursă. Să facem aceasta. Acum, subiectul nostru pe forum arată astfel:</p> <div class="flex justify-center" data-svelte-h="svelte-xc5zie"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic04.png" alt="Exemplul nostru de subiect pe forum, cu traceback-ul complet." width="100%"></div> <p data-svelte-h="svelte-1nv45yw">Aceasta este mult mai informativă, și un cititor atent ar putea fi capabil să indice că problema pare să se datoreze trecerii unei intrări lungi din cauza acestei linii în traceback:</p> <blockquote data-svelte-h="svelte-1cf7hkp"><p>Token indices sequence length is longer than the specified maximum sequence length for this model (583 > 512).</p></blockquote> <p data-svelte-h="svelte-dcoy3i">Cu toate acestea, putem face lucrurile și mai ușoare pentru ei prin furnizarea codului real care a declanșat eroarea. Să facem asta acum.</p> <h3 class="relative group"><a id="furnizarea-unui-exemplu-reproductibil" 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="#furnizarea-unui-exemplu-reproductibil"><span><svg class="" 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>Furnizarea unui exemplu reproductibil</span></h3> <p data-svelte-h="svelte-sdduj4">Dacă ați încercat vreodată să depanați codul altcuiva, probabil că ați încercat mai întâi să recreați problema pe care au raportat-o astfel încât să puteți începe să vă faceți drumul prin traceback pentru a identifica eroarea. Nu este diferit când vine vorba de a obține (sau a da) asistență pe forumuri, așa că ajută cu adevărat dacă puteți furniza un exemplu mic care reproduce eroarea. Jumătate din timp, simpla parcurgere a acestui exercițiu vă va ajuta să vă dați seama ce merge prost. În orice caz, piesa lipsă din exemplul nostru este să arătăm <em>intrările</em> pe care le-am furnizat modelului. Făcând aceasta ne dă ceva ca următorul exemplu completat:</p> <div class="flex justify-center" data-svelte-h="svelte-8gjogl"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic05.png" alt="Versiunea finală a subiectului nostru pe forum." width="100%"></div> <p data-svelte-h="svelte-1hug5sz">Acest subiect conține acum destul de multe informații și este scris într-un mod care este mult mai probabil să atragă atenția comunității și să primească un răspuns util. Cu aceste ghiduri de bază, puteți acum crea subiecte grozave pentru a găsi răspunsurile la întrebările voastre 🤗 Transformers!</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/course/blob/main/chapters/rum/chapter8/3.mdx" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1ftlxhy = { | |
| assets: "/docs/course/pr_1069/rum", | |
| base: "/docs/course/pr_1069/rum", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/course/pr_1069/rum/_app/immutable/entry/start.1de7c3d2.js"), | |
| import("/docs/course/pr_1069/rum/_app/immutable/entry/app.1f82014c.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 87], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 32.2 kB
- Xet hash:
- 9d2d0af5556367e68b8de7d7ec5219a89adfb9e943c91a3c195f061dea4610e5
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.