3-Fine-tuning_a_pretrained_model-5-End-of-chapter_quiz
中英文对照学习,效果更佳!
原课程链接:https://huggingface.co/course/chapter3/6?fw=pt
End-of-chapter quiz
章末测验
问一个问题
Test what you learned in this chapter!
测试一下你在这一章中学到的东西!
1. The emotion dataset contains Twitter messages labeled with emotions. Search for it in the Hub, and read the dataset card. Which of these is not one of its basic emotions?
1.emotion数据集包含带有情感标签的推特消息。在集线器中搜索它,并读取数据集卡。以下哪一项不是它的基本情绪之一?
Joy
Joy
Love
喜爱
Confusion
混乱
Surprise
惊喜
- Search for the
ar_sarcasmdataset in the Hub. Which task does it support?
Sentiment classification
在Hub中搜索ar_sarCasm数据集。它支持什么任务?情感分类
Machine translation
机器翻译
Named entity recognition
命名实体识别
Question answering
答疑
- How does the BERT model expect a pair of sentences to be processed?
Tokens_of_sentence_1 [SEP] Tokens_of_sentence_2
BERT模型期望如何处理一对句子?TOKENS_OF_SEP_2
[CLS] Tokens_of_sentence_1 Tokens_of_sentence_2
[CLS]语句1的标记语句2的标记
[CLS] Tokens_of_sentence_1 [SEP] Tokens_of_sentence_2 [SEP]
[CLS]语句1的标记[SEP]语句2的标记[SEP]
[CLS] Tokens_of_sentence_1 [SEP] Tokens_of_sentence_2
[CLS]语句1的标记[SEP]语句2的标记
- What are the benefits of the
Dataset.map()method?
The results of the function are cached, so it won’t take any time if we re-execute the code.
`Dataset.map()`方法有什么好处?函数的结果是缓存的,所以如果我们重新执行代码,不会花费任何时间。
It can apply multiprocessing to go faster than applying the function on each element of the dataset.
它可以应用多处理以比对数据集的每个元素应用函数更快。
It does not load the whole dataset into memory, saving the results as soon as one element is processed.
它不会将整个数据集加载到内存中,而是在处理一个元素后立即保存结果。
- What does dynamic padding mean?
It’s when you pad the inputs for each batch to the maximum length in the whole dataset.
动态填充是什么意思?当您将每个批次的输入填充到整个数据集中的最大长度时。
It’s when you pad your inputs when the batch is created, to the maximum length of the sentences inside that batch.
它是在创建批处理时将您的输入填充到该批处理中句子的最大长度。
It’s when you pad your inputs so that each sentence has the same number of tokens as the previous one in the dataset.
这是当您填充您的输入,以便每个句子与数据集中的前一个句子具有相同数量的标记时。
- What is the purpose of a collate function?
It ensures all the sequences in the dataset have the same length.
COLLATE函数的用途是什么?它确保数据集中的所有序列具有相同的长度。
It puts together all the samples in a batch.
它将所有的样品放在一批中。
It preprocesses the whole dataset.
它会对整个数据集进行预处理。
It truncates the sequences in the dataset.
它截断数据集中的序列。
- What happens when you instantiate one of the
AutoModelForXxxclasses with a pretrained language model (such asbert-base-uncased) that corresponds to a different task than the one for which it was trained?
Nothing, but you get a warning.
如果您使用预先训练的语言模型(如bert-base-unased)实例化其中一个AutoModelForXxx类,而该模型对应的任务与其训练的任务不同,会发生什么情况?没有,但您会收到警告。
The head of the pretrained model is discarded and a new head suitable for the task is inserted instead.
丢弃预先训练的模型的头部,代之以插入适合于该任务的新头部。
The head of the pretrained model is discarded.
预先训练的模型的头部将被丢弃。
Nothing, since the model can still be fine-tuned for the different task.
没有什么,因为模型仍然可以针对不同的任务进行微调。
- What’s the purpose of
TrainingArguments?
It contains all the hyperparameters used for training and evaluation with the Trainer.
`TrainingArguments的用途是什么?它包含了用于Traine`训练和评估的所有超参数。
It specifies the size of the model.
它指定模型的大小。
It just contains the hyperparameters used for evaluation.
它只包含用于计算的超参数。
It just contains the hyperparameters used for training.
它只包含用于训练的超参数。
- Why should you use the 🤗 Accelerate library?
It provides access to faster models.
为什么要使用🤗Accelerate库?它提供了对更快型号的访问。
It provides a high-level API so I don’t have to implement my own training loop.
它提供了一个高级API,因此我不必实现自己的训练循环。
It makes our training loops work on distributed strategies
它使我们的培训循环在分布式策略上发挥作用
It provides more optimization functions.
它提供了更多优化功能。
