from transformers import ByT5Tokenizer, T5ForConditionalGeneration model_name = "google/byt5-base" print(f"Downloading and saving {model_name} locally...") # Download tokenizer and model tokenizer = ByT5Tokenizer.from_pretrained(model_name) model = T5ForConditionalGeneration.from_pretrained(model_name, use_safetensors=True) # Save to a NEW directory to keep it separate from your small model save_path = "./byt5_base_local_weights" tokenizer.save_pretrained(save_path) model.save_pretrained(save_path) print(f"Done! Weights are now in {save_path}")