Question 1
Pre-Tokenization
Normalization
Post Processor
Tokenization Algorithm
Decoder

The IIT Madras BS Deep Learning Practice (Deep Learning Practice) Quiz 1 paper sat on 27 Oct 2024, in the September 2024 term: 15 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Pre-Tokenization
Normalization
Post Processor
Tokenization Algorithm
Decoder
Correct answer
Post Processor
Choose the Hugging Face module that helps us train a tokenizer from scratch on a specific dataset.
tokenizers
transformers
evaluate
Autotrain
Accelerate
Correct answer
tokenizers
A dataset contains 10 billion words ( separated by a single white space). Suppose we use a pre- trained tokenizer that has a vocabulary of size 10,000 to tokenize the dataset, then the number of tokens in the dataset will always be greater than or equal to the number of words in the dataset. The statement is
True
False
Correct answer
True
Which of the following tokenization algorithms can be applied to languages that do not have any word delimiters?
BPE (Byte Pair Encoding)
Wordpiece
Sentencepiece
Correct answer
Sentencepiece
Consider the Wikipedia dataset scraped from the web that contains 2 billion words. A team decided to use the BPE tokenization algorithm with the varying vocabulary size from 2K to 52K, then the statement that increasing the number of merges will increase the size of the vocabulary is
True
False
Insufficient information
Correct answer
True
Suppose that we pre-train a Causal Language Model. Choose the data collator function from the Hugging Face library that is suitable for this task
DataCollator(tokenizer)
DefaultDataCollator(tokenizer)
DataCollatorForLanguageModelling(tokenizer,mlm=False)
DataCollatorForCausalLanguageModelling(tokenizer)
DataLoader(tokenizer)
Correct answer
DataCollatorForLanguageModelling(tokenizer,mlm=False)
The IMDB dataset has 25000 samples in the training split. It contains two columns, named, text and label. Consider the code snippet given below and choose all the correct statements
from datasets import load_datasetimdb_dataset = load_dataset("stanfordnlp/imdb",split='train')
def get_num_words(example): num_words = len(example["text"].split()) return {'num_words':num_words}
ds = imdb_dataset.map(get_num_words)Correct answers
Consider two datasets namely "ds1" and "ds2" . The structure of the dataset with the number of samples in each split is given below. Suppose we create a new dataset in the following ways. Assume necessary
DatasetDict({ train: Dataset({ features: ['text', 'label'], num_rows: 25000 }) test: Dataset({ features: ['text', 'label'], num_rows: 25000 }) unsupervised: Dataset({ features: ['text', 'label'], num_rows: 50000 })})ds1
DatasetDict({ train: Dataset({ features: ['text', 'label'], num_rows: 8530 }) test: Dataset({ features: ['text', 'label'], num_rows: 1066 }) unsupervised: Dataset({ features: ['text', 'label'], num_rows: 1066 })})ds2
imports and the statements are executed independently (i.e., an error in executing a statement does not affect the execution of other statements). Select all the correct statements.
ds3 = datasets.concatenate_datasets([ds1,ds2])ds4 = datasets.concatenate_datasets([ds1['train'],ds2['train']])ds5 = datasets.concatenate_datasets([ds1['train'],ds2['test']])ds6 = datasets.concatenate_datasets( [ds1['train'],ds1['test'], ds2['train'],ds2['validation']])Correct answers
Correct answers
ids
tokens
offsets
attention_mask
special_token_mask
type_ids
vocab_size
Correct answers
ids
tokens
offsets
attention_mask
special_token_mask
type_ids
Here is a configuration of the GPTNeo model from the Hugging Face hub.
"bos_token_id": 50256,"classifier_dropout": 0.1,"embed_dropout": 0.0,"eos_token_id": 50256,"hidden_size": 2048,"initializer_range": 0.02,"intermediate_size": null,"layer_norm_epsilon": 1e-05,"max_position_embeddings": 2048,"model_type": "gpt_neo","num_heads": 16,"num_layers": 24,"resid_dropout": 0.0,"transformers_version": "4.44.2","use_cache": true,"vocab_size": 50257,"window_size": 256Figure 1: GPTNeoConfig
Based on the above data, answer the given subquestions.
Enter the number of parameters in the embedding layer of the model in millions. For example, if the answer is 1234567. Then enter it as 1.23
Correct answer: 102.5 (accepted within ±0.5)
Here is a configuration of the GPTNeo model from the Hugging Face hub.
"bos_token_id": 50256,"classifier_dropout": 0.1,"embed_dropout": 0.0,"eos_token_id": 50256,"hidden_size": 2048,"initializer_range": 0.02,"intermediate_size": null,"layer_norm_epsilon": 1e-05,"max_position_embeddings": 2048,"model_type": "gpt_neo","num_heads": 16,"num_layers": 24,"resid_dropout": 0.0,"transformers_version": "4.44.2","use_cache": true,"vocab_size": 50257,"window_size": 256Figure 1: GPTNeoConfig
Based on the above data, answer the given subquestions.
Enter the context length.
Correct answer: 2048
Here is a set of training arguments used by the GPT-2 model that was pre-trained on a dataset that contains 10 billion tokens. The context length of the model is modified to 2048, the vocabulary size is 50,257 and the embedding dimension is 768. The length of all the samples in a batch is equal to the context length of the model.
training_args = TrainingArguments( output_dir='out', evaluation_strategy="steps", eval_steps=500, num_train_epochs=1, per_device_train_batch_size=16, per_device_eval_batch_size=16, tf32=True, gradient_accumulation_steps=2, adam_beta1=0.9, adam_beta2=0.999, learning_rate=2e-5, weight_decay=0.01, logging_dir='logs', logging_strategy="steps", logging_steps = 500, save_steps=5000, save_total_limit=20, report_to='wandb', )Based on the above data, answer the given subquestions.
Enter the number of tokens (in millions) processed by the model after 1000 steps. Enter the answer to 2 decimal places. For example, if your answer is 123456789, then enter it as 123.45.
Correct answer: 65.5 (accepted within ±0.2)
Here is a set of training arguments used by the GPT-2 model that was pre-trained on a dataset that contains 10 billion tokens. The context length of the model is modified to 2048, the vocabulary size is 50,257 and the embedding dimension is 768. The length of all the samples in a batch is equal to the context length of the model.
training_args = TrainingArguments( output_dir='out', evaluation_strategy="steps", eval_steps=500, num_train_epochs=1, per_device_train_batch_size=16, per_device_eval_batch_size=16, tf32=True, gradient_accumulation_steps=2, adam_beta1=0.9, adam_beta2=0.999, learning_rate=2e-5, weight_decay=0.01, logging_dir='logs', logging_strategy="steps", logging_steps = 500, save_steps=5000, save_total_limit=20, report_to='wandb', )Based on the above data, answer the given subquestions.
How many steps does it take to complete one epoch of training? Enter the answer in thousands (round down to an integer). For example, if your answer is 1234567.89, then enter it as 1234567.
Correct answer: 152.5 (accepted within ±0.5)
Correct answer: 500