File size: 380 Bytes
f28517c |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
# Model name to download
model_name = "gpt2"
# Download the GPT-2 model and tokenizer
model = GPT2LMHeadModel.from_pretrained(model_name)
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
# Save the model and tokenizer files locally
model.save_pretrained("./gpt2_model")
tokenizer.save_pretrained("./gpt2_tokenizer")
|