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

Hi,

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 README.md

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

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

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 train.py , it would mean the following addition from line 94?

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

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

# define training args
training_args = TrainingArguments(
output_dir=args.model_dir,
etc.)

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

Thank you for your response but I do not understand it.
Please, could you pass the code to write into the training script train.py and how to access the model card after training? Thank you.