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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add
push_to_hub
to pipeline #29172add
push_to_hub
to pipeline #29172Changes from 17 commits
61d8277
8396070
910581d
0329b39
4be0c35
8fc4ac5
25bdabe
c025667
d513918
ede0d55
547edb6
e69e241
6b108db
e777027
b465ac5
e51ee44
226e1a5
8b524fc
1210fdd
4872b57
a3db605
5912999
a87d6fd
33cc7f5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a
# Copied from
comment here as it's the same as the implementation in configuration_utils.pyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that I am reading this I realize that this is an extra method I will remove it now since the
def _set_token_in_kwargs
is already defined insrc\transformers\configuration_utils.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well in
src\transformers\modeling_utils.py
in thedef save_pretrained
they didn't even import nor create a function to add the token to the kwargs.IMO the
_set_token_in_kwargs
should be moved to thePushToHubMixin
instead, this should help a lot to avoid changing every single class manually, for now I will settle in simply adding a comment since that enhancement is out of scope in this pr, do let me know if you approve of this, if so can you open another issue and tag me, I'll try to contribute to thatEDIT:
same goes for lots of other classes, I think we definitely should implement the DRY principle here and add the
_set_token_in_kwargs
to thePushToHubMixin
instead especially since this is repetitive and we have a parameter that will be deprecatedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_set_token_in_kwargs
is only defined in the config class. In fact, looking at it - we shouldn't need it here at all. This is a work around to account for the fact some models' config classes have their ownfrom_pretrained
method - but this isn't the case for pipelinesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for the clarification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit confuses me - since you're inheriting
PushToHubMixin.push_to_hub
,__doc__
should always be defined, right? I can see it's a copy of the same code for the other classes that inherit fromPushToHubMixin
, though, I'm just not sure why it's coded this way. Not a blocker, just a comment!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since other people used this method to copy the docs i chose to use the same one as them, to stay in the same page as them, just to avoid straying too much from the norm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's totally fine! I was just pointing out my own confusion, I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true that, i think the reason for them using this annotation is that they only need to change one method (the original one) to change the docs for all of the other classes using it.
meaning one changes all, which is a really nice approach