-
Notifications
You must be signed in to change notification settings - Fork 31.7k
fix torch_dtype, contiguous, and load_state_dict regression #36512
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
Conversation
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the |
|
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. |
…ssion' into fix-dtype-and-contiguous-regression
| folder = None | ||
|
|
||
| model.expected_keys = expected_keys | ||
| model_to_load.expected_keys = expected_keys |
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 we are calling _fix_state_dict_keys_on_load on model_to_load
ArthurZucker
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
…ace#36512) * fix regression * fix param * fix load_state_dict * style * better fix for module * fix tests * quick fix for now * rm print
…ace#36512) * fix regression * fix param * fix load_state_dict * style * better fix for module * fix tests * quick fix for now * rm print
| distribute_module(module_to_tp, device_mesh, None, input_fn, output_fn) | ||
| else: | ||
| module_to_tp.load_state_dict({param_type: param[:]}, strict=False, assign=True) | ||
| param = param[:] |
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.
@SunMarc why is param = param[:] needed?
edit - ok, this is for safetensors. Unfortuantely safetensors get_slice does not play well with 0-dim tensors :( huggingface/safetensors#380
What does this PR do ?
This PR fixes the regression we have from #36335:
load_state_dictmap_location default to "cpu" + couples of small fixes -> fixes CI !get_submodule_get_module_from_nametoget_module_nameis it also handles the case where the param name reference to a direct param from the model.Should fixes tests in peft and in the quantization CI
Perf with TP 2 GPUS: