Files
dsp15/download_weights.py
T
2026-05-21 01:21:51 +08:00

15 lines
548 B
Python

from transformers import ByT5Tokenizer, T5ForConditionalGeneration
model_name = "google/byt5-small"
print("Downloading and saving model locally...")
tokenizer = ByT5Tokenizer.from_pretrained(model_name)
# This forces the download of the safetensors version
model = T5ForConditionalGeneration.from_pretrained(model_name, use_safetensors=True)
# Save to a local directory in your project folder
tokenizer.save_pretrained("./byt5_local_weights")
model.save_pretrained("./byt5_local_weights")
print("Done! Weights are now in ./byt5_local_weights")