File size: 824 Bytes
57bdca5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
In the [PushToHubCallback`] function, add: An output directory for your model. A tokenizer. The hub_model_id, which is your Hub username and model name. from transformers import PushToHubCallback push_to_hub_callback = PushToHubCallback( output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model" ) Add the callback to fit, and 🤗 Transformers will push the trained model to the Hub: model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback) Use the push_to_hub function You can also call push_to_hub directly on your model to upload it to the Hub. Specify your model name in push_to_hub: pt_model.push_to_hub("my-awesome-model") This creates a repository under your username with the model name my-awesome-model. |