Skip to content

chore(typing): added modeling_utils to ty#45425

Merged
tarekziade merged 11 commits intomainfrom
tarekziade-typing-modeling
Apr 27, 2026
Merged

chore(typing): added modeling_utils to ty#45425
tarekziade merged 11 commits intomainfrom
tarekziade-typing-modeling

Conversation

@tarekziade
Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds type checking to modeling_utils.py

@tarekziade tarekziade requested a review from vasqu April 14, 2026 06:56
@tarekziade tarekziade self-assigned this Apr 14, 2026
@tarekziade tarekziade force-pushed the tarekziade-typing-modeling branch from e61b897 to d46cd16 Compare April 14, 2026 06:59
@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.

@tarekziade
Copy link
Copy Markdown
Collaborator Author

see #45458

Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Some initial comments: I think there are few potentially breaking changes so let's be careful

Comment thread .ai/skills/add-or-fix-type-checking/SKILL.md
Comment thread src/transformers/modeling_utils.py
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
if not isinstance(config, PreTrainedConfig):
config_path = config if config is not None else pretrained_model_name_or_path
config, model_kwargs = cls.config_class.from_pretrained(
config_class = cls.config_class
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, out of scope but maybe could be a good static rule to always define it

Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
@tarekziade tarekziade force-pushed the tarekziade-typing-modeling branch from 73aea30 to a559d96 Compare April 16, 2026 07:47
@tarekziade tarekziade requested a review from vasqu April 16, 2026 09:17
Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

Just some smaller stuff left but looks good overall 🤗

Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py Outdated
Comment thread src/transformers/modeling_utils.py
Comment thread src/transformers/modeling_utils.py
Comment thread src/transformers/modeling_utils.py
@tarekziade tarekziade force-pushed the tarekziade-typing-modeling branch from 9200ee2 to cc3c90a Compare April 24, 2026 07:43
@tarekziade tarekziade force-pushed the tarekziade-typing-modeling branch from cc3c90a to eeb9fb2 Compare April 27, 2026 06:40
Copy link
Copy Markdown
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

Comment thread src/transformers/utils/generic.py
tarekziade and others added 2 commits April 27, 2026 15:12
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
@tarekziade tarekziade enabled auto-merge April 27, 2026 13:15
@tarekziade tarekziade disabled auto-merge April 27, 2026 13:15
@tarekziade tarekziade enabled auto-merge April 27, 2026 13:18
@tarekziade tarekziade added this pull request to the merge queue Apr 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 27, 2026
@tarekziade tarekziade added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 133d68e Apr 27, 2026
29 checks passed
@tarekziade tarekziade deleted the tarekziade-typing-modeling branch April 27, 2026 15:11
@qgallouedec
Copy link
Copy Markdown
Member

this PR broke TRL's CI, I'm investigating

@qgallouedec
Copy link
Copy Markdown
Member

ArthurZucker pushed a commit that referenced this pull request Apr 28, 2026
* chore(typing): added modeling_utils to ty

* revert uneeded setattr

* refine the skill with what we have learned here

* revert change on skill

* @vasqu reviews

* added a small helper for splitting the attention impl

* remove unneeded ty check

* added a comment

* Update src/transformers/utils/generic.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* fix trailng spaces from the Github UI edit

---------

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
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