Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Yêu cầu trợ giúp trên diễn đàn","local":"yêu-cầu-trợ-giúp-trên-diễn-đàn","sections":[{"title":"Viết một bài đăng tốt trên diễn đàn","local":"viết-một-bài-đăng-tốt-trên-diễn-đàn","sections":[{"title":"Choosing a descriptive title","local":"choosing-a-descriptive-title","sections":[],"depth":3},{"title":"Định dạng các đoạn mã của bạn","local":"định-dạng-các-đoạn-mã-của-bạn","sections":[],"depth":3},{"title":"Bao gồm toàn bộ truy vết","local":"bao-gồm-toàn-bộ-truy-vết","sections":[],"depth":3},{"title":"Cung cấp một ví dụ có thể tái tạo","local":"cung-cấp-một-ví-dụ-có-thể-tái-tạo","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/course/pr_1069/vi/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/entry/start.bcd19957.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/scheduler.37c15a92.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/singletons.20a6a839.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/index.18351ede.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/paths.c89f4ad2.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/entry/app.38d32b86.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/index.2bf4358c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/nodes/0.cba642dc.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/nodes/64.c5908672.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/Youtube.1e50a667.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/CodeBlock.4e987730.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/DocNotebookDropdown.efc1fb7c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1069/vi/_app/immutable/chunks/getInferenceSnippets.24b50994.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Yêu cầu trợ giúp trên diễn đàn","local":"yêu-cầu-trợ-giúp-trên-diễn-đàn","sections":[{"title":"Viết một bài đăng tốt trên diễn đàn","local":"viết-một-bài-đăng-tốt-trên-diễn-đàn","sections":[{"title":"Choosing a descriptive title","local":"choosing-a-descriptive-title","sections":[],"depth":3},{"title":"Định dạng các đoạn mã của bạn","local":"định-dạng-các-đoạn-mã-của-bạn","sections":[],"depth":3},{"title":"Bao gồm toàn bộ truy vết","local":"bao-gồm-toàn-bộ-truy-vết","sections":[],"depth":3},{"title":"Cung cấp một ví dụ có thể tái tạo","local":"cung-cấp-một-ví-dụ-có-thể-tái-tạo","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="yêu-cầu-trợ-giúp-trên-diễn-đàn" 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="#yêu-cầu-trợ-giúp-trên-diễn-đàn"><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>Yêu cầu trợ giúp trên diễn đàn</span></h1> <div class="flex space-x-1 absolute z-10 right-0 top-0"> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/vi/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/vi/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-1oufsg8"><a href="https://discuss.huggingface.co" rel="nofollow">Diễn đàn Hugging Face</a> là nơi tuyệt vời để nhận được sự giúp đỡ từ các nhóm nguồn mở và cộng đồng Hugging Face. Trang chủ luôn trông như sau:</p> <div class="flex justify-center" data-svelte-h="svelte-14n1ttz"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forums.png" alt="The Hugging Face forums." width="100%"></div> <p data-svelte-h="svelte-8ihszs">Ở bên tay trái, bạn có thể thấy tất cả các danh mục mà các chủ đề khác nhau được nhóm lại, trong khi bên tay phải hiển thị các chủ đề gần đây nhất. Chủ đề là một bài đăng có chứa tiêu đề, danh mục và mô tả; nó khá giống với định dạng vấn đề GitHub mà chúng ta đã thấy khi tạo tập dữ liệu của riêng mình trong <a href="/course/chapter5">Chương 5</a>. Như tên cho thấy, danh mục <a href="https://discuss.huggingface.co/c/beginners/5" rel="nofollow">Beginners</a> chủ yếu dành cho những người mới bắt đầu với hệ sinh thái và thư viện Hugging Face. Mọi câu hỏi trên bất kỳ thư viện nào đều được hoan nghênh ở đó, có thể là để gỡ lỗi một số mã hoặc để yêu cầu trợ giúp về cách thực hiện điều gì đó. (Điều đó nói rằng, nếu câu hỏi của bạn liên quan đến một thư viện cụ thể, bạn có thể nên chuyển đến danh mục thư viện tương ứng trên diễn đàn.)</p> <p data-svelte-h="svelte-1s5db8u">Tương tự, danh mục <a href="https://discuss.huggingface.co/c/intermediate/6" rel="nofollow">Intermediate</a>và <a href="https://discuss.huggingface.co/c/research/7" rel="nofollow">Research</a> dành cho các câu hỏi nâng cao hơn , ví dụ về thư viện hoặc một số nghiên cứu NLP mới thú vị mà bạn muốn thảo luận.</p> <p data-svelte-h="svelte-2v6e8y">Và đương nhiên, chúng ta cũng nên đề cập đến danh mục <a href="https://discuss.huggingface.co/c/course/20" rel="nofollow">Course</a>, nơi bạn có thể đặt bất kỳ câu hỏi nào liên quan đến khóa học Hugging Face!</p> <p data-svelte-h="svelte-1tpzgkv">Khi bạn đã chọn một danh mục, bạn sẽ sẵn sàng viết chủ đề đầu tiên của mình. Bạn có thể tìm thấy một số <a href="https://discuss.huggingface.co/t/how-to-request-support/3128" rel="nofollow">hướng dẫn</a> trong diễn đàn về cách thực hiện việc này và trong phần này chúng ta sẽ xem xét một số tính năng tạo nên một chủ đề hay.</p> <h2 class="relative group"><a id="viết-một-bài-đăng-tốt-trên-diễn-đàn" 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="#viết-một-bài-đăng-tốt-trên-diễn-đàn"><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>Viết một bài đăng tốt trên diễn đàn</span></h2> <p data-svelte-h="svelte-e1aia6">Như một ví dụ, giả sử rằng chúng ta đang cố gắng tạo các biểu diễn từ các bài viết trên Wikipedia để tạo một công cụ tìm kiếm tùy chỉnh. Như thường lệ, chúng ta tải tokenizer và mô hình như sau:</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-1nn90lj">Giờ giả sử ta đang cố nhúng toàn bộ phần này của <a href="https://en.wikipedia.org/wiki/Transformers" rel="nofollow">Wikipedia</a> lên Transformers:</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-go4e1k">Rất tiếc, chúng ta đã gặp sự cố - và thông báo lỗi khó hiểu hơn nhiều so với những thông báo chúng ta thấy trong <a href="/course/chapter8/section2">phần 2</a>! Chúng ta không thể thực hiện được toàn bộ quá trình truy vết, vì vậy chúng ta quyết định chuyển sang diễn đàn Hugging Face để được trợ giúp. Làm thế nào chúng ta có thể tạo ra chủ đề?</p> <p data-svelte-h="svelte-1jgkume">Để bắt đầu, chúng ta cần nhấp vào nút “New Topic” hay “Chủ đề mới” ở góc trên bên phải (lưu ý rằng để tạo chủ đề, chúng ta cần đăng nhập):</p> <div class="flex justify-center" data-svelte-h="svelte-1guiktj"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forums-new-topic.png" alt="Creating a new forum topic." width="100%"></div> <p data-svelte-h="svelte-6s8vvn">Thao tác này sẽ hiển thị một giao diện viết, nơi chúng ta có thể nhập tiêu đề của chủ đề của mình, chọn một danh mục và soạn thảo nội dung:</p> <div class="flex justify-center" data-svelte-h="svelte-xij8sp"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic01.png" alt="The interface for creating a forum topic." width="100%"></div> <p data-svelte-h="svelte-1tin9ry">Vì lỗi dường như chỉ xảy ra với 🤗 Transformers, nên chúng ta sẽ chọn lỗi này cho danh mục. Nỗ lực đầu tiên của chúng ta trong việc giải thích vấn đề có thể trông giống như sau:</p> <div class="flex justify-center" data-svelte-h="svelte-3f05is"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic02.png" alt="Drafting the content for a new forum topic." width="100%"></div> <p data-svelte-h="svelte-o8ris3">Mặc dù chủ đề này chứa thông báo lỗi mà chúng tôi cần trợ giúp, nhưng có một số vấn đề với cách viết:</p> <ol data-svelte-h="svelte-nqdjoy"><li>Tiêu đề không mang tính mô tả cao, vì vậy bất kỳ ai duyệt diễn đàn sẽ không thể biết chủ đề là gì nếu không đọc phần nội dung.</li> <li>Phần thân không cung cấp đủ thông tin về <em>nơi</em> bắt nguồn lỗi và <em>cách</em> để tạo lại lỗi đó.</li> <li>Chủ đề gắn thẻ trực tiếp một vài người với giọng điệu hơi khắt khe.</li></ol> <p data-svelte-h="svelte-12pvtvm">Các chủ đề như thế này không có khả năng nhận được câu trả lời nhanh (nếu họ nhận được một câu trả lời nào đó), vì vậy hãy xem cách chúng ta có thể cải thiện nó. Chúng ta sẽ bắt đầu với vấn đề đầu tiên là chọn một tiêu đề hay.</p> <h3 class="relative group"><a id="choosing-a-descriptive-title" 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="#choosing-a-descriptive-title"><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>Choosing a descriptive title</span></h3> <p data-svelte-h="svelte-1sc5n08">Nếu bạn đang cố gắng nhận trợ giúp về một lỗi trong mã của mình, một nguyên tắc chung là đưa đủ thông tin vào tiêu đề để người khác có thể nhanh chóng xác định xem họ có nghĩ rằng họ có thể trả lời câu hỏi của bạn hay không. Trong ví dụ đang chạy của mình, chúng ta biết tên của ngoại lệ đang được nêu ra và có một số gợi ý rằng nó được kích hoạt trong phần truyền thẳng của mô hình, nơi chúng tôi gọi là <code>model(**inputs)</code>. Để thông báo điều này, một tiêu đề có thể có là:</p> <blockquote data-svelte-h="svelte-qp1hky"><p>Source of IndexError in the AutoModel forward pass?</p></blockquote> <p data-svelte-h="svelte-voe212">hay</p> <blockquote data-svelte-h="svelte-1ix64cd"><p>Nguồn của IndexError trong thẻ chuyển tiếp AutoModel?</p></blockquote> <p data-svelte-h="svelte-1nabzc8">Tiêu đề này cho người đọc biết bạn nghĩ rằng lỗi đến từ <em>đâu</em> và nếu họ đã gặp phải <code>IndexError</code> trước đó, thì rất có thể họ sẽ biết cách gỡ lỗi nó. Tất nhiên, tiêu đề có thể là bất kỳ thứ gì bạn muốn và các biến thể khác như:</p> <blockquote data-svelte-h="svelte-15dhjoh"><p>Why does my model produce an IndexError?</p></blockquote> <p data-svelte-h="svelte-voe212">hay</p> <blockquote data-svelte-h="svelte-jh5xn"><p>Tại sao mô hình của tôi tạo ra một IndexError?</p></blockquote> <p data-svelte-h="svelte-1y4u0ow">cũng có thể ổn. Bây giờ chúng ta đã có một tiêu đề mô tả, hãy xem cách cải thiện nội dụng phần thân bài.</p> <h3 class="relative group"><a id="định-dạng-các-đoạn-mã-của-bạn" 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="#định-dạng-các-đoạn-mã-của-bạn"><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>Định dạng các đoạn mã của bạn</span></h3> <p data-svelte-h="svelte-4zci19">Đọc mã nguồn đã đủ khó trong IDE, nhưng còn khó hơn khi mã được sao chép và dán dưới dạng văn bản thuần túy! May mắn thay, các diễn đàn về Hugging Face hỗ trợ việc sử dụng Markdown, vì vậy bạn nên luôn đặt các khối mã của mình bằng ba dấu gạch ngược (```) để dễ đọc hơn. Hãy làm điều này để sửa chữa thông báo lỗi - và trong khi chúng ta xử lý nó, hãy làm cho phần nội dung lịch sự hơn một chút so với phiên bản gốc của mình:</p> <div class="flex justify-center" data-svelte-h="svelte-pol4zs"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic03.png" alt="Our revised forum topic, with proper code formatting." width="100%"></div> <p data-svelte-h="svelte-slupip">Như bạn có thể thấy trong ảnh chụp màn hình, việc bao bọc các khối mã trong dấu gạch ngược sẽ chuyển văn bản thô thành mã được định dạng, hoàn chỉnh với kiểu màu! Cũng lưu ý rằng các dấu gạch ngược đơn lẻ có thể được sử dụng để định dạng các biến nội tuyến, giống như chúng tôi đã làm cho <code>distilbert-base-unsased</code>. Chủ đề này có vẻ tốt hơn nhiều và với một chút may mắn, chúng ta có thể tìm thấy ai đó trong cộng đồng có thể đoán được lỗi là gì. Tuy nhiên, thay vì dựa vào may mắn, chúng ta hãy làm cho cuộc sống dễ dàng hơn bằng cách đưa vào chi tiết đầy đủ các truy vết của nó!</p> <h3 class="relative group"><a id="bao-gồm-toàn-bộ-truy-vết" 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="#bao-gồm-toàn-bộ-truy-vết"><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>Bao gồm toàn bộ truy vết</span></h3> <p data-svelte-h="svelte-19763jz">Vì dòng cuối cùng của bản truy vết thường đủ để gỡ lỗi đoạn mã của riêng bạn, nên bạn có thể chỉ cung cấp dòng đó trong chủ đề của mình để “tiết kiệm dung lượng”. Mặc dù có chủ ý tốt, điều này thực sự khiến người khác có thể <em>khó</em> gỡ lỗi vấn đề <em>hơn</em> vì thông tin cao hơn trong bản truy xuất có thể thực sự hữu ích. Vì vậy, một phương pháp hay là sao chép và dán <em>toàn bộ</em> dấu vết, đồng thời đảm bảo rằng nó được định dạng độc đáo. Vì những lần truy xuất này có thể mất nhiều thời gian, một số người thích hiển thị chúng sau khi họ đã giải thích mã nguồn. Làm thôi nào. Bây giờ, chủ đề diễn đàn của chúng ta trông giống như sau:</p> <div class="flex justify-center" data-svelte-h="svelte-1oxns09"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic04.png" alt="Our example forum topic, with the complete traceback." width="100%"></div> <p data-svelte-h="svelte-1dgk1gh">Điều này có nhiều thông tin hơn và một người đọc cẩn thận có thể chỉ ra rằng vấn đề dường như là do chuyển một đầu vào dài vì dòng này trong bản truy xuất:</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-iwco10">Tuy nhiên, chúng ta có thể khiến mọi thứ trở nên dễ dàng hơn với họ bằng cách cung cấp mã thực đã gây ra lỗi. Hãy làm điều đó ngay bây giờ.</p> <h3 class="relative group"><a id="cung-cấp-một-ví-dụ-có-thể-tái-tạo" 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="#cung-cấp-một-ví-dụ-có-thể-tái-tạo"><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>Cung cấp một ví dụ có thể tái tạo</span></h3> <p data-svelte-h="svelte-b7q2yx">Nếu bạn đã từng cố gắng gỡ lỗi đoạn mã của người khác, trước tiên có thể bạn đã cố gắng tạo lại sự cố mà họ đã báo cáo để bạn có thể bắt đầu làm việc theo cách của mình thông qua truy xuất để xác định lỗi. Nó không khác gì khi nói đến (hoặc cung cấp) hỗ trợ trên các diễn đàn, vì vậy sẽ thực sự hữu ích nếu bạn có thể cung cấp một ví dụ nhỏ mô tả lại lỗi. Một nửa thời gian, chỉ cần đi qua bài tập này sẽ giúp bạn nhận ra điều gì đang xảy ra. Trong mọi trường hợp, phần còn thiếu trong ví dụ của chúng ta là hiển thị <em>các đầu vào</em> mà ta đã cung cấp cho mô hình. Làm điều đó cho chúng ta một cái gì đó giống như ví dụ đã hoàn thành sau:</p> <div class="flex justify-center" data-svelte-h="svelte-1ckd2c8"><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/forum-topic05.png" alt="The final version of our forum topic." width="100%"></div> <p data-svelte-h="svelte-doleby">Chủ đề này hiện chứa khá nhiều thông tin và nó được viết theo cách có nhiều khả năng thu hút sự chú ý của cộng đồng và nhận được câu trả lời hữu ích. Với những hướng dẫn cơ bản này, giờ đây bạn có thể tạo các chủ đề tuyệt vời để tìm câu trả lời cho các câu hỏi về 🤗 Transformers của mình!</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/vi/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_rdxbtd = { | |
| assets: "/docs/course/pr_1069/vi", | |
| base: "/docs/course/pr_1069/vi", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/course/pr_1069/vi/_app/immutable/entry/start.bcd19957.js"), | |
| import("/docs/course/pr_1069/vi/_app/immutable/entry/app.38d32b86.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 64], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 32.8 kB
- Xet hash:
- 28a1831554e1e337d8a0cf89176735c0c47377444c9b8520d6283501167db582
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.