Add dates to the model docs
Author: MHRDYN7
Pull request: yes

Implementation of the feature requested in #39319 (please look at the issue for more info).

The file add_paper_dates_on_docs.py inside utils contains the main code. 

Current trivial strategy:
Collect the paper id from the first link to hf papers -> use arxiv api to get the dates -> write the dates info below the last html '</div>' tag. 

```python 
# for the paper publication and last update dates
paper_ids = re.findall(r"https://huggingface\.co/papers/(\d+\.\d+)", content)
if paper_ids:
    paper_id = paper_ids[0]
    try:
        search = Search(id_list=[paper_id])
        results = client.results(search)
        result = next(results)
        published_date = result.published.date()
        updated_date = result.updated.date()
```

```python
# for HF integration date
first_commit_date = subprocess.check_output(["git", "log", "--reverse", "--pretty=format:%ad", "--date=iso", path],text=True).strip().split('\n')[0][:10]  
```

Most models that have an associated paper have got the html tags for the torch symbol on top, but some new model_docs don't seem to have that properly and those have been missed with this logic. Although it is highly likely that the first link to a paper is the main paper, I did find a good deal of suspicious dates on a random check, so there should be a much more robust strategy.

Comments:
Currently, I've added the dates info (in italics) right after the `<!--Copyright ... -->` section. Three models (sam_hq, cohere and cohere2) don't have this copyright section, so this needs to be fixed -> todo

There are 80 model cards without any paper, but many of those have a blog post link -> todo 

**IMPORTANT:** the hf_commit_date is either from the init file in the model's folder (in most cases) or if the model is very old and therefore in maintenance mode (so folder doesn't exist), the first commit date of the model is shown in hf_commit_date. However, this does not reflect the actual date when this model was added to hf, but only the date when that particular path was created (most commonly 2023-06-20; the last path renaming date).

The functions inside utils/add_dates.ipynb (temp file) can be used in future and for that a proper workflow design is needed. You may find the list of model cards without papers + other info there. @stevhliu 

cc @stevhliu 

A gentle ping @stevhliu 

Summary of the pr so far.
Model release date + HF integration dates have been added on top of all the model cards.
* The first commit date of the init file in model's folder is used for the HF integration date. If that does not exist (generally true for legacy models), the doc's first commit date is used.
* For the model's release date
    If the model card had only one hf paper link, that paper's publish date is used. This is a bit blind approach (in case the linked paper is not associated), and I've fixed any obvious error case that caught my eyes, but there are 200+ model cards in this category, so there might be some discrepancies which should be solved by the community over time.

    If the model card had no paper link, I added the links (if they existed), otherwise did sufficient research to get to the approx release date via blog post, github commit date, check point upload date on hf etc. Sufficient hints have been added via links so that anybody investigating those models can actually find the first source of that model. I think the dates on these models are very accurate and must not be changed in the future.

    Also for the model cards with multiple papers, I did go through them carefully and ensured the correct date is used. Sometimes, the blog post is released first and a paper after a few months and for that the blog post's date is used.
* I think only the addition of the hf_commit_date should be automated (probably as part of `make fixup` or some command used at the end of model addition), while it's better to leave the release date to the contributors.
* A general convention I used to attach the paper and blog post links is `[Model_name](paper_link) ([blog post](blog_post_link))`, embracing such a standard (mine is just an example) will help easily retrieve the links much more easily via functions, if needed in future. I have used this standard only for the model cards for which I newly found the relevant paper and/or blog post.
* Also, I've tried to replace the links with hf papers link, where ever possible, otherwise replaced with the arxiv link if they existed. Still there are three model papers for which an arxiv link exits but they are still not available on hf papers.

Sorry for the delay!

Let's add this as a script in `transformers/utils/` and maybe add as part of `make repo-consistency`? wdyt @ArthurZucker?

Yep for sure! 

@stevhliu this pr is very much ready 

# Summary of utils/add_dates.py script

* First of all, the arxiv paper links and hf.co/papers are replaced with huggingface.co/paper links for the model cards found in diff.
* Checks if the copyright disclaimer section "<!--Copyright 2025 The HuggingFace Team..." on top is present, if not, it is added.
* If the dates info line is already present, only the commit date is checked and updated if needed, the release date is kept unchanged.
* If the dates info line is not present already
    * The publish date of the first hugginface paper is added via huggingface_hub.paper_info().
    * However, if the words "blog","post","report" are found, a message pops up asking for the release date of the blog post/ technical report to be added even if a paper link exists. This is because, in most cases blog posts are released before the papers.
    * If there is a valid arxiv link, but the paper has not yet been uploaded to hf papers, a message is shown, but no date is added. I've created a global dictionary `ARXIV_PAPERS_NOT_IN_HF_PAPERS` at the top of the script, which should be used to keep track of  these papers and upload them to hf papers from time to time. The date of these arxiv papers can surely be added via the arxiv api, but I'm skipping that to avoid adding a new dependency library, and also so that these papers are actively added to hf papers.
    * If there is no hf or arxiv paper link, the possible paper links present in the model card are printed so that maintainers manually add the dates from those links.
* This script is a part of make repo-consistency

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39320). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.