Smaller output vocabulary for GPT-2
# ❓ Questions & Help
I noticed that by default, GPT2LMHeadModel returns prediction scores of shape (batch_size, sequence_length, config.vocab_size) ([docs link](https://huggingface.co/transformers/model_doc/gpt2.html#gpt2lmheadmodel)). Is there any way for me to limit the output vocabulary to only a subset of words?

I want to take the existing weights from GPT-2, but re-train a new top linear layer with a smaller vocabulary. I suppose I could mask the logits at the end, but then it feels like a waste of computational power to even predict them.

**A link to [original question on the forum](https://discuss.huggingface.co/t/smaller-output-vocabulary-for-gpt-2/366)**
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
