Push_to_hub() from HuggingFaceEstimator in AWS Sagemaker


I guess there is an easy answer but I did not find it.

Use case: I did train a model in a HF Training DLC in AWS SageMaker through a HuggingFaceEstimator.fit(). Now, I would like to upload this trained model to the model hub of Hugging Face.

What is the equivalent code to the model.push_to_hub() for a HuggingFaceEstimator in AWS Sagemaker?


If you want to push your model to the Hugging Face Hub you can do this directly inside the train.py as shown here: notebooks/sagemaker/14_train_and_push_to_hub at master · huggingface/notebooks · GitHub
or you need to download the model.tar.gz and push it to hub afterwards Documentation. There is currently no method inside the sagemaker-sdk to push models to the hub after training.

1 Like