-
Notifications
You must be signed in to change notification settings - Fork 30.6k
[v5] Remove model_parallel
deprecated feature
#41166
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
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. |
if getattr(model, "is_parallelizable", False) and getattr(model, "model_parallel", False): | ||
self.is_model_parallel = True | ||
else: | ||
self.is_model_parallel = False | ||
|
||
self.is_model_parallel = False | ||
if getattr(model, "hf_device_map", None) is not None: | ||
devices = [device for device in set(model.hf_device_map.values()) if device not in ["cpu", "disk"]] | ||
if len(devices) > 1: | ||
self.is_model_parallel = True | ||
elif len(devices) == 1: | ||
self.is_model_parallel = self.args.device != torch.device(devices[0]) | ||
else: | ||
self.is_model_parallel = False | ||
|
||
# warn users | ||
if self.is_model_parallel: | ||
logger.info( | ||
"You have loaded a model on multiple GPUs. `is_model_parallel` attribute will be force-set" | ||
" to `True` to avoid any unexpected behavior such as device placement mismatching." | ||
) |
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 is what changed in trainer cc @qgallouedec
model_parallel
model_parallel
deprecated feature
[For maintainers] Suggested jobs to run (before merge) run-slow: bloom, camembert, codegen, decision_transformer, falcon_mamba, gpt2, gpt_neo, gpt_neox_japanese, gptj, imagegpt, kosmos2_5, lilt, luke, mamba, modernbert_decoder, moshi |
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.
Nice cleanup, thanks a lot! 🤗 Happy to see it disappear!
What does this PR do?
This PR removes deprecates code related to
model_parallel
feature in the modeling as well as in Trainer. This was a feature that was added only for a few models like t5 and gpt2 but eventually we switched to using device_map and tp now.For the models, we removes
is_parallelizable
andmodel_parallel
attributes and some deprecated methods.For Trainer, we remove a small section related to
model_parallel
.