（呼呼） (whoosh)
- 在本视频中，我们将学习第一件事 - In this video we'll learn the first things to
当你得到一个错误时做。 do when you get an error.
这不是将笔记本电脑扔出窗外。 This is not throwing your laptop through the window.
假设我们要使用问答管道 Let's say we want to use the question answering pipeline
在特定型号上，我们收到以下错误。 on a particular model and we get the following error.
Python 中的错误可能看起来势不可挡 Errors in Python can appear overwhelming
因为你得到了很多信息打印出来 because you get so much information printed out
但那是因为 Python 试图帮助你 but that's because Python is trying to help you
尽其所能解决你的问题。 the best it can to solve your problem.
在本视频中，我们将了解如何解读 In this video, we'll see how to interpret
我们得到的错误报告。 the error report we get.
首先要注意的是顶部 The first thing to notice at the very top
是 Python 给你显示了一个清晰的箭头 is that Python shows you with a clear arrow
触发错误的代码行 the line of code that triggers the error
所以你不必摆弄你的代码 so you don't have to fiddle with your code
并删除随机线以找出 and remove random lines to figure out
错误来自哪里。 where the error comes from.
答案就在你面前。 You have the answer in front of you right here.
你在下面看到的错误是代码的一部分 The errors you see below are a part of the code
Python 试图在运行指令时执行。 Python tried to execute while running the instruction.
我们在管道函数中 Here we are inside the pipeline function
零出现在这条线上 and zero came on this line
在尝试执行函数 “check_tasks” 时， while trying to execute the function "check_tasks,"
然后引发了我们看到的 KeyError 显示。 which then raised the KeyError we see displayed.
请注意，Python 会准确地告诉你 Note that Python tells you exactly
它正在执行的功能所在的位置， where the function it's executing lives,
所以如果你喜欢冒险 so if you feel adventurous
你甚至可以去检查源代码。 you can even go inspect the source code.
这整件事被称为 “追溯”。 This whole thing is called the "Traceback."
如果你在 Colab 上运行代码 If you're running your code on Colab
Traceback 自动最小化， the Traceback is automatically minimized,
所以你必须点击展开它。 so you have to click to expand it.
在回溯的最后 At the very end of the Traceback
你终于得到了实际的错误信息。 you finally get the actual error message.
遇到你应该做的第一件事 The first thing you should do when encountering
错误是阅读该错误消息。 an error is to read that error message.
它告诉我们它不知道 Here it's telling us it doesn't know
问答任务 the question answering task
并帮助我们列出了清单 and helpfully gives us the list
我们可以看到支持的任务 of supported tasks in which we can see
那个 “问答” 实际上是。 that "question-answering" actually is.
仔细一看， Looking more closely though,
我们用下划线来惊奇这两个词 we used an underscore to surprise the two words
当任务写有减号时， when the task is written with a minus,
所以我们应该解决这个问题。 so we should fix that.
现在让我们用正确编写的标签重试我们的代码 Now let's retry our code with the tags properly written
今天发生了什么？ and what is happening today?
另一个错误。 Another error.
正如我们之前所说，我们去看看底部 As we said before, we go look at the bottom
阅读实际的错误信息。 to read the actual error message.
它告诉我们应该检查 It's telling us that we should check
我们的模型是正确的模型标识符， our model is a correct model identifier,
所以让我们跳到 hf.co/models。 so let's hop onto hf.co/models.
我们可以看到我们的模型列在那里 We can see our model listed there
在可用于问答的那些。 in the ones available for question answering.
不同之处在于它拼写为 “distilbert” The difference is that it's spelled "distilbert"
用一个 L，我们用两个， with one L, and we use two,
所以让我们解决这个问题。 so let's fix that.
我们终于得到了结果。 We finally get our results.
如果我们的错误更复杂， If our error is more complex,
你可能需要使用 Python 调试器。 you might need to use the Python debugger.
查看下面的视频以了解操作方法。 Check out the videos below to learn how.