Skip to content
ml-recall

#weight-tying

1 question from LLM Fundamentals & Prompting

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

mediumAI-checkedLLM Fundamentals & Prompting

The book's GPTModel with the GPT-2 small configuration has separate input-embedding and output layers. What does the last line print?

GPT_CONFIG_124M = {"vocab_size": 50257, "context_length": 1024, "emb_dim": 768,
                   "n_heads": 12, "n_layers": 12, "drop_rate": 0.1, "qkv_bias": False}
model = GPTModel(GPT_CONFIG_124M)
total = sum(p.numel() for p in model.parameters())
print(total)                                    # 163009536
print(model.tok_emb.weight.shape)               # torch.Size([50257, 768])
print(model.out_head)                           # Linear(in_features=768, out_features=50257, bias=False)
print(total - sum(p.numel() for p in model.out_head.parameters()))

an integer