Skip to content

Python code in model docs - #45608

Merged
zucchini-nlp merged 16 commits into
huggingface:mainfrom
zucchini-nlp:docs-pythoncode
Apr 29, 2026
Merged

Python code in model docs#45608
zucchini-nlp merged 16 commits into
huggingface:mainfrom
zucchini-nlp:docs-pythoncode

Conversation

@zucchini-nlp

Copy link
Copy Markdown
Member

What does this PR do?

  • Deletes all torch_dtype and dtype, since we load models in default dtype from config in v5
  • Uses plain python code (find and delete all >>> and ... )

Batch updating because I see many comments in new model PRs asking users to fix it, though the best way is for us to fix old docs

@vasqu , do you have any other recurring/annoying patterns? Would be great to reduce number of nitty-picky PR comments, and save us time for more important tasks

@vasqu

vasqu commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

One quick one: missing device map auto on models and or missing movement from prepared input .to(model.device)

@zucchini-nlp

Copy link
Copy Markdown
Member Author

This will need an agent help, not super regex friedly. Oke, noted

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@zucchini-nlp
zucchini-nlp force-pushed the docs-pythoncode branch 2 times, most recently from 19f0410 to 01c0319 Compare April 23, 2026 19:35
@zucchini-nlp

Copy link
Copy Markdown
Member Author

@stevhliu this PR is generated by find-replace and code agent. As per title, eliminates most common patterns in new model reviews, so users don't copy a bad example

Whenever you have time, can you reveiew?

@zucchini-nlp
zucchini-nlp requested a review from stevhliu April 24, 2026 09:46
@vasqu

vasqu commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

@zucchini-nlp Another one maybe for a different PR: Using httpx vs requests. Sorry dropping stuff as I review other models atm :D

@zucchini-nlp

zucchini-nlp commented Apr 24, 2026

Copy link
Copy Markdown
Member Author

No prob, gotta keep docs clean and anyway it is the LLM doing the work, I just re-check. Defi another PR opportunity :)

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks for the clean up! 🧹 some issues i've noticed so far:

  • using the wrong bnb arg (bnb_4bit_compute_bnb_4bit_quant_type vs bnb_4bit_quant_dtype)
  • double commas after the model
  • indenting off for some device_map args
  • some examples use device=0 while others device=0 is removed

Comment thread docs/source/en/model_doc/align.md
Comment thread docs/source/en/model_doc/aya_vision.md Outdated
Comment thread docs/source/en/model_doc/bigbird_pegasus.md Outdated
Comment thread docs/source/en/model_doc/biogpt.md
Comment thread docs/source/en/model_doc/bitnet.md
Comment thread docs/source/en/model_doc/gemma.md Outdated
Comment thread docs/source/en/model_doc/gemma.md
Comment thread docs/source/en/model_doc/gemma3.md Outdated
Comment thread docs/source/en/model_doc/glm4_moe_lite.md Outdated
Comment thread docs/source/en/model_doc/glm_moe_dsa.md Outdated
@zucchini-nlp

zucchini-nlp commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

Love vibe-coding, always have to check and clean manually afterwards 😄 I'll go over and fix those

@zucchini-nlp

Copy link
Copy Markdown
Member Author

I think it is better now, applied ruff to fix indentation, reverted all device=0 which were deleted incorrectly and fixed the merged Bnb names

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few more things, but otherwise lgtm! i'll add these conventions to my model doc skill so all future model docs follow these :)

Comment thread docs/source/en/model_doc/glmasr.md Outdated
Comment thread docs/source/en/model_doc/glmasr.md Outdated
Comment thread docs/source/en/model_doc/glmasr.md Outdated
Comment thread docs/source/en/model_doc/glmasr.md Outdated
Comment thread docs/source/en/model_doc/gptj.md Outdated
Comment thread docs/source/en/model_doc/gptj.md Outdated
Comment thread docs/source/en/model_doc/llama3.md Outdated
@stevhliu stevhliu mentioned this pull request Apr 27, 2026
zucchini-nlp and others added 2 commits April 28, 2026 12:13
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
@zucchini-nlp

Copy link
Copy Markdown
Member Author

Yep, thanks, imo with the skill and a bit more requirements on using the provided doc-template, we can cut down time spent reviewing new model docs

@zucchini-nlp
zucchini-nlp added this pull request to the merge queue Apr 29, 2026
Merged via the queue into huggingface:main with commit 223fe52 Apr 29, 2026
16 checks passed
@zucchini-nlp
zucchini-nlp deleted the docs-pythoncode branch April 29, 2026 09:51
This was referenced Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants