

TITLE
Trainer's create_model_card creates an invalid yaml metadata `datasets: - null`

COMMENTS
12

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
## Environment info

- any env

### Who can help

- discussed with @julien-c @sgugger and @LysandreJik 

## Information

- The hub will soon reject push with invalid model card metadata,
- **only when `datasets`, `model-index` or `license` are present**, their content need to follow the specification cf. https://github.com/huggingface/huggingface_hub/pull/342

## To reproduce

Steps to reproduce the behavior:

1. Train a model
2. Do not association any datasets
3. The trained model and the model card are rejected by the server

## Expected behavior

trainer.py git push should be successfull, even with the coming patch https://github.com/huggingface/transformers/pull/13514
