Allow modifications of attributes in modular#41450
Closed
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
Author
|
After internal discussion: this would harm the overall modular philosophy, adding a mutable inside classes like this. For the moment, we accept rewriting modular files which differ just by an attribute naming. (cc @yonigozlan ) Instead, a util to convert on load with 0 cost would be preferrable, and is in the works. cc @Cyrilvallez @ArthurZucker |
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.
What does this PR do?
Often, attributes are not derived from model names. Modular files based on a given model are then bloated because there is a tiny change in an attribute, needing the entire thing to be rewritten. See https://github.com/huggingface/transformers/pull/41224/files here for instance.
This introduces an attribute renamer, from an arbitrary attribute name to another.
On the attached PR, this expands the modeling file correctly.