-
Notifications
You must be signed in to change notification settings - Fork 644
[transformers_modeling_backend] Upgrade transformers from 4.57.1 to 5.0.0rc0 #2154
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
base: main
Are you sure you want to change the base?
Conversation
torchtitan/experiments/transformers_modeling_backend/model/model.py
Outdated
Show resolved
Hide resolved
34285a5 to
b6bad9a
Compare
|
Upgrading to transformers v5 fixes it as it no longer uses |
wwwjn
left 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.
LGTM!
|
fixed linting |
| if module.padding_idx is not None: | ||
| module.weight.data[module.padding_idx].zero_() | ||
| if isinstance(module.weight.data, DTensor): | ||
| module.weight.data._local_tensor[module.padding_idx].zero_() |
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.
sorry I probably didn't what you are doing here.
If the padding is on the "global tensor", we should just do the same thing module.weight.data[module.padding_idx].zero_()
The code here is doing local modification, which may or may not be correct depending on if the padding_idx is meant to be local or global.
This fixes: huggingface#6
Thanks to do that we can do
torch.compile+ 4D-//ism on HF model (cf huggingface#5)