Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/transformers/integrations/tensor_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ def shard_and_distribute_module(
else:
logger.info(f"Tensor sharding plan for {param_name}: {current_shard_plan}")

tp_layer = None
if current_shard_plan is not None:
try:
tp_layer = ALL_PARALLEL_STYLES[current_shard_plan]
Expand All @@ -1488,7 +1489,8 @@ def shard_and_distribute_module(
if not isinstance(param, torch.nn.Parameter):
param = torch.nn.Parameter(param, requires_grad=empty_param.is_floating_point())
setattr(module_to_tp, param_type, param)
tp_layer.update_module_attributes(module_to_tp)
if tp_layer is not None:
tp_layer.update_module_attributes(module_to_tp)
return param


Expand Down
Loading