Repository navigation
[Docs] Fix from_pretrained integration example - #5105
Merged
hanouticelina merged 1 commit intoOct 7, 2026
Merged
Conversation
|
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. |
Contributor
|
This PR has been shipped as part of the v2.2.0 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
from_pretrainedexample can be parsed as Python.model_idargument tohf_hub_download, instead of the undefinedrepo_id. For example,from_pretrained("test/model")now forwardsrepo_id="test/model".Validation
IndentationError; the corrected snippet parses successfully.make stylepassed. Ruff lint/format and repository consistency checks passed;ty check srcpassed.make qualityremains blocked by an existing generated CLI reference mismatch indocs/source/en/package_reference/cli.md. That unrelated file is unchanged in this PR.AI assistance was used to identify, verify, and prepare this documentation fix.
Note
Low Risk
Documentation-only change to a code snippet; no runtime or API behavior is affected.
Overview
Corrects the integrations guide’s sample
from_pretrainedimplementation so it is valid, copy-pasteable Python.The example body is indented consistently inside the function, and
hf_hub_downloadnow usesrepo_id=model_idinstead of an undefinedrepo_id, matching themodel_idparameter shown in the signature.Reviewed by Cursor Bugbot for commit d9396ae. Bugbot is set up for automated code reviews on this repo. Configure here.