- 如何在 GitHub 上写出好的 issue？ - How to write a good issue on GitHub?
GitHub 是主要的地方 GitHub is the main place
对于 Hugging Face 开源库， for the Hugging Face open source libraries,
你应该经常去那里报告错误 and you should always go there to report a bug
或求新功能。 or ask for a new feature.
对于更一般的问题或调试你自己的代码 For more general questions or to debug your own code
使用论坛，请参阅下面链接的视频。 use the forums, see the video linked below.
写好 issue 很重要 It's very important to write good issues
因为它将帮助你发现的错误被立即修复。 as it will help the bug you uncovered be fixed in no time.
对于这个视频，我们创建了一个版本的 Transformers For this video, we have created a version of Transformers
带有一个错误。 with a bug.
你可以通过在笔记本中执行此命令来安装它， You can install it by executing this command in a notebook,
删除感叹号以在终端中执行它。 remove the exclamation mark to execute it in a terminal.
在此版本中，以下示例失败。 In this version, the following example fails.
错误是相当神秘的 The error is rather cryptic
并且似乎不是来自我们代码中的任何内容， and does not seem to come from anything in our code,
所以我们似乎有一个错误要报告。 so it seems we have a bug to report.
在这种情况下要做的第一件事 The first thing to do in this case
是试图找到尽可能少的代码 is to try to find the smallest amount of code possible
重现错误。 that reproduces the bug.
在我们的例子中，检查回溯， In our case, inspecting the traceback,
我们看到失败发生在 pipeline 数内部 we see the failure happens inside the pipeline function
当它调用 AutoTokenizer.from_pretrained 时。 when it calls AutoTokenizer.from_pretrained.
使用调试器，我们找到传递给该方法的值 Using the debugger, we find the values passed to that method
因此可以创建一个小的代码示例 and can thus create a small sample of code
希望产生相同的错误。 that hopefully generates the same error.
完成这一步非常重要 It's very important to go though this step
你可能意识到错误在你这边 as you may realize the error was on your side
而不是库中的错误， and not a bug in the library,
但它也会让维护者更容易 but it also will make it easier for the maintainers
来解决你的问题。 to fix your problem.
在这里我们可以更多地使用这段代码 Here we can play around a bit more with this code
并注意错误发生在不同的 checkpoints and notice the error happens for different checkpoints
不只是这个， and not just this one,
当我们使用 use_fast=False 时它会消失 and that it disappears when we use use_fast=False
在我们的 tokenizer 调用中。 inside our tokenizer call.
重要的是要有东西 The important part is to have something
不依赖于任何外部文件或数据。 that does not depend on any external files or data.
尝试用虚假的值替换你的数据 Try to replace your data by fake values
如果你不能分享它。 if you can't share it.
完成所有这些后， With all of this done,
我们准备开始写我们的 issue 。 we are ready to start writing our issue.
单击 Bug Report (错误报告) 旁边的按钮 Click on the button next to Bug Report
你会发现有一个模板可以填写。 and you will discover that there is a template to fill.
只需几分钟。 It will only take you a couple of minutes.
首先是正确命名你的 issue 。 The first thing is to properly name your issue.
不要选择过于模糊的标题。 Don't pick a title that is too vague.
然后你必须填写你的环境信息。 Then you have to fill your environment information.
提供了一个命令 There is a command provided
由 Transformers 库来执行此操作。 by the Transformers library to do this.
只需在笔记本或终端中执行即可 Just execute it in your notebook or in a terminal
并复制粘贴结果。 and copy paste the results.
最后两个问题需要手动填写， There are two last questions to fill manually,
在我们的案例中，答案是否定的。 to which the answers are no and no in our case.
接下来，我们需要确定标记谁。 Next, we need to determine who to tag.
模板中有完整的用户名列表。 There is a full list of usernames in the template.
由于我们的问题与 tokenizer 有关， Since our issue has to do with tokenizers,
我们选择与他们相关的维护者。 we pick the maintainer associated with them.
标记超过 3 个人是没有意义的， There is no point tagging more than 3 people,
他们会将你重定向到合适的人 they will redirect you to the right person
如果你犯了错误。 if you made a mistake.
接下来，我们必须提供必要的信息 Next, we have to give the information necessary
重现错误。 to reproduce the bug.
我们粘贴样本，并将其放在两行之间 We paste our sample, and put it between two lines
带有三个反引号，以便正确格式化。 with three backticks so that it's formatted properly.
我们还粘贴了完整的回溯， We also paste the full traceback,
仍然在两行三个反引号之间。 still between two lines of three backticks.
最后，我们可以添加任何其他信息 Lastly, we can add any additional information
关于我们试图调试手头问题的内容。 about what we tried to debug the issue at hand.
有了这一切，你应该期待一个答案 With all of this, you should expect an answer
非常快地解决你的 issue ，希望能快速解决。 to your issue pretty fast and hopefully a quick fix.
请注意，此视频中的所有建议 Note that all the advise in this video
适用于几乎所有的开源项目。 applies for almost every open-source project.