# End-of-chapter quiz

Test what you learned in this chapter!

### 1.「情緒」數據集包含標記有情緒的 Twitter 消息。在[模型中心](https://huggingface.co/datasets)中搜索它，然後讀取數據集卡。哪一個不是它的基本情感？

### 2.在[模型中心](https://huggingface.co/datasets)中搜索‘ ar _ sarcasm’數據集，它支持哪個任務？
 dataset card  ！"
		},
		{
			text: "命名實體識別",
			explain: "不是這樣的ーー再看看  dataset card  ！"
		},
        {
			text: "回答問題",
			explain: "Alas, this question was not answered correctly. 再試一次！"
		}
	]}
/>

### 3.BERT 模型期望如何處理一對句子？
 [ CLS ]  特殊令牌在開始時是必需的，但是這不是唯一的事情！"
		},
		{
			text: "表示句子1[ SEP ]的符號表示句子2[ SEP ]",
			explain: "沒錯！",
            correct: true
		},
        {
			text: "表示句子1[ SEP ]的符號表示句子2",
			explain: "開頭需要一個  [ CLS ]  特殊標記，還需要一個  [ SEP ]  特殊標記來分隔兩個句子，但這還不是全部！"
		}
	]}
/>

{#if fw === 'pt'}
### 4.‘ Dataset.map ()’方法的好處是什麼？

### 5.什麼是動態填充？

### 6.校對函數的用途是什麼？
 > DataCollatorWithPadding  。"
		},
		{
			text: "它把所有的樣品一批一批地放在一起。",
			explain: "正確！ You can pass the collate function as an argument of a DataLoader. We used the DataCollatorWithPadding function, which pads all items in a batch so they have the same length.",
            correct: true
		},
		{
			text: "它預處理整個數據集。",
			explain: "這將是一個預處理函數，而不是校對函數。"
		},
        {
			text: "它截斷數據集中的序列。",
			explain: "校對函數用於處理單個批處理，而不是整個數據集。如果您對截斷感興趣，可以使用  tokenizer  的  參數。"
		}
	]}
/>

### 7.當你用一個預先訓練過的語言模型(例如‘ bert-base-uncased’)實例化一個‘ AutoModelForXxx’類，這個類對應於一個不同於它所被訓練的任務時會發生什麼？
 Trainer  所做的，而不是 Accelerate 庫。再試一次！",
            correct: true
		},
		{
			text: "丟棄預先訓練好的模型頭部。",
			explain: "Something else needs to happen. 再試一次！"
		},
        {
			text: "沒有，因為模型仍然可以針對不同的任務進行微調。",
			explain: "這個經過訓練的模特的頭沒有經過訓練來解決這個問題，所以我們應該丟掉這個頭！"
		}
	]}
/>

### 8.訓練爭論的目的是什麼？
 TrainingArguments  。"
		},
		{
			text: "它只包含用於評估的超參數。",
			explain: "In the example, we specified where the model and its checkpoints will be saved. 再試一次！"
		},
        {
			text: "您可以輕鬆地計算與數據集相關的指標。",
			explain: "In the example, we used an evaluation_strategy as well, so this impacts evaluation. 再試一次！"
		}
	]}
/>

### 9.為什麼要使用 Accelerate 庫？
Trainer, not the 🤗 Accelerate library. 再試一次！"
		},
		{
			text: "它使我們的訓練循環工作在分佈式策略上",
			explain: "正確! 隨著加速，你的訓練循環將為多個 gpu 和 TPUs 工作。",
            correct: true
		},
        {
			text: "它提供了更多的優化功能。",
			explain: "不，Accelerate 庫不提供任何優化功能。"
		}
	]}
/>

{:else}
### 4.當你用一個預先訓練過的語言模型(例如‘ bert-base-uncased’)實例化一個‘ tfautoodelforxxx’類時，會發生什麼？

### 5.來自“變壓器”的 TensorFlow 模型已經是 Keras 模型，這有什麼好處？
 TPUStrategy  scope 中的所有內容，包括模型的初始化。"
		},
		{
			text: "您可以利用現有的方法，如  compile ()  、  fit ()  和  predict ()  。",
			explain: "正確! 一旦你有了這些數據，在這些數據上進行培訓只需要很少的工作。",
            correct: true
		},
		{
			text: "你可以學習 Keras 和變形金剛。",
			explain: "沒錯，但我們要找的是別的東西:)",
			correct: true
		},
        {
			text: "困惑",
			explain: "Keras 幫助我們訓練和評估模型，而不是計算與數據集相關的度量。"
		}
	]}
/>

### 6.如何定義自己的定製度量？
 tfkeras.metrics. Metric  。",
			explain: "太好了！",
			correct: true
		},
		{
			text: "使用 Keras 函數 API。",
			explain: "再試一次！"
		},
		{
			text: "通過使用帶簽名的可調用  metric _ fn (y _ true，y _ pred)  。",
			explain: "正確！",
			correct: true
		},
        {
			text: "通過谷歌搜索。",
			explain: "這不是我們要找的答案，但它應該能幫助你找到答案。",
			correct: true
		}
	]}
/>

{/if}

