add dataset metadata to model card
# 🚀 Feature request
When pulling a dataset from the hub, it would be useful to have some metadata about the specific dataset and version that is used. The metadata could then be passed to the `Trainer` which could then be saved to a model card. 

## Motivation

This is useful for people who run many experiments on different versions (commits/branches) of the same dataset.



I opened an issue in `datasets` related to this because the metadata is currently unavailable for `Trainer`: https://github.com/huggingface/datasets/issues/4129
Might be of interest to @sgugger <|||||>Once the issue is solved on the Datasets side, the work on the Trainer can begin.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.<|||||>@sgugger I just realized that in addition to tracking the dataset version, it would be important to also track the model version. Most pre-trained models shouldn't be changing, but this would be useful to have for the private hub.  Would it make sense to include the revision in the model config file? That way the information would stay with the model files even if `push_to_hub` wasn't used.  I guess it could still be lost if someone saves the state_dict instead of calling `save_pretrained` but I don't think that happens very often.<|||||>The revision is accessible whenever a user downloads a model so we know it. We can add it as a private variable in the config once it's loaded, but it shouldn't be saved as the revision will change every time the config is pushed.<|||||>When you say "the revision will change" are you referring to the revision associated with the model that just got fine-tuned or the revision associated with the pre-trained model that was used as the starting point for the fine-tuning?<|||||>The revision will change at each commit, so it's not something we can store and then push to the Hub as it will instantly mismatch the actual commit sha.<|||||>I'm not sure I follow what you are saying. Here is an example representing what I had in mind.

I want to fine-tune bert-base-cased on squad. When I call from_pretrained, that pulls the most recent commit for the bert-base-cased repo, a8d257ba9925ef39f3036bfc338acf5283c512d9. Likewise, when I pull squad it pulls the most recent commit, d04f25d7823ef492730bfcf7ae02f363c2373a28.

I proceed to fine-tune the model and then when I save it, I would like it to be known that I started with bert-base-cased at revision = a8d257ba9925ef39f3036bfc338acf5283c512d9 and the model was trained on squad at d04f25d7823ef492730bfcf7ae02f363c2373a28.

If I then push a README.md file, there will be a new revision for the newly fine-tuned model. I don't need to track that. As long as I don't modify the model weights, I would like it to be tracked that I started with bert-base-cased at revision = a8d257ba9925ef39f3036bfc338acf5283c512d9 and it was trained on squad at d04f25d7823ef492730bfcf7ae02f363c2373a28

Does that make sense?<|||||>Yes, I'm just saying there is no point saving in the config file of your bert-base-cased model the sha of the commit (which we won't know before pusing).<|||||>Ok got it.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.