Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/transformers/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ def __post_init__(self, **kwargs):
if per_layer_config is not None:
self.per_layer_config = per_layer_config

# TODO: to support models whose input embedding module is not named `embed_tokens` (e.g. GPT-NeoX's `embed_in`).
if getattr(self, "tie_word_embeddings", False) and self.base_model_tp_plan is not None:
self.base_model_tp_plan = {
**self.base_model_tp_plan,
"embed_tokens": "embedding_rowwise",
}

def __init_subclass__(cls, *args, **kwargs):
super().__init_subclass__(*args, **kwargs)
cls_has_custom_init = "__init__" in cls.__dict__
Expand Down
5 changes: 4 additions & 1 deletion src/transformers/distributed/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def init_parallel_plans(self) -> None:

if self.base_model is self:
self._pp_plan.update(self.config.base_model_pp_plan or {})
self._tp_plan.update(self.config.base_model_tp_plan or {})
tp_plan = dict(self.config.base_model_tp_plan or {})
if tp_plan and getattr(self.config, "tie_word_embeddings", False):
tp_plan.setdefault(getattr(self, "_input_embed_layer", "embed_tokens"), "embedding_rowwise")
self._tp_plan.update(tp_plan)
self._ep_plan.update(self.config.base_model_ep_plan or {})
self._fsdp_plan.update(self.config.base_model_fsdp_plan or {})

Expand Down
Loading