fix break for ckpt without _tp_plan (#39658)
* fix break for ckpt without _tp_plan * Update src/transformers/modeling_utils.py * Update src/transformers/modeling_utils.py --------- Co-authored-by: wangzhengtao <wangzhengtao@msh.team> Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This commit is contained in:
@@ -5991,8 +5991,9 @@ def caching_allocator_warmup(model: PreTrainedModel, expanded_device_map: dict,
|
|||||||
if not accelerator_device_map:
|
if not accelerator_device_map:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
tp_plan = getattr(model, "_tp_plan", []) or []
|
||||||
tp_plan_regex = (
|
tp_plan_regex = (
|
||||||
re.compile("|".join([re.escape(plan) for plan in model._tp_plan]))
|
re.compile("|".join([re.escape(plan) for plan in tp_plan]))
|
||||||
if _torch_distributed_available and torch.distributed.is_initialized()
|
if _torch_distributed_available and torch.distributed.is_initialized()
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user