Skip to content

Conversation

@qubvel
Copy link
Contributor

@qubvel qubvel commented Apr 4, 2025

What does this PR do?

Classes such as PoolerStartLogits, PoolerEndLogits, PoolerAnswerClass, SQuADHead, and SequenceSummary are:

  1. Defined in modeling_utils.py, which is somewhat against the main repository philosophy of having classes defined within dedicated modeling files
  2. Used by a few older models and not used by newer ones

Following the above, I have transferred them to the corresponding modeling files and deprecated those in modeling_utils.py. This should unclutter modeling_utils.py and make it easier to remove those classes when models are going to be deprecated.

@qubvel
Copy link
Contributor Author

qubvel commented Apr 4, 2025

run-slow: gpt2, xlm, xlnet, electra

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2025

This comment contains run-slow, running the specified jobs: This comment contains run-slow, running the specified jobs:

models: ['models/gpt2', 'models/xlm', 'models/xlnet']
quantizations: [] ...

@HuggingFaceDocBuilderDev

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.

@qubvel qubvel marked this pull request as ready for review April 7, 2025 17:59
@qubvel qubvel requested a review from Rocketknight1 April 7, 2025 17:59
@qubvel
Copy link
Contributor Author

qubvel commented Apr 10, 2025

cc @Rocketknight1 when you have bandwidth

@Rocketknight1
Copy link
Member

Change seems good but this is kind of a core library philosophy issue, so we'll need a core maintainer review! cc @Cyrilvallez

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

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

100% agree, they have nothing to do in modeling_utils.py, I have been wondering why they are there for some time!! Thanks a lot for tackling this! 🤗 If the slow tests are similar as main, it's good to go!

Just a small nit: I suppose https://github.com/huggingface/transformers/blob/main/utils/check_config_attributes.py#L330-L342 this is not needed anymore then, as thex are part of the main modeling files now? So we could remove this dead code?

@qubvel qubvel merged commit 4f58fc9 into huggingface:main Apr 18, 2025
20 checks passed
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request May 14, 2025
* Move utils classes into models

* Add deprecation warnings

* Remove from docs

* Update config attributes check
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