How to write automatically the model card into the file model.tar.gz?


When I run notebook and script from 01_getting_started_pytorch in AWS Sagemaker, I do not get in the file model.tar.gz (where my best model is saved in s3) the model card

It’s strange as I did get it before through my training jobs in AWS Sagemaker…

How can I get automatically the model card file into the file model.tar.gz?
A code to change in the training script

You can additionally run trainer.creade_model_card [Ref], which creates the model card in the output_dir.

Thank you @philschmid.

In the training script , it would mean the following addition from line 94?

# Saves the model to s3
trainer.creade_model_card() # new

And the model card would then be saved in output_dir of line 62 (the args.model_dir)?

# define training args
training_args = TrainingArguments(

If yes, how can I access it (this output_dir) after end of training? (in s3 I guess but which link?)

All training jobs should have and output s3 bucket you can check the it in the UI or via sdk