Skip to content

Commit c5ca092

Browse files
committed
Merge if-queries
1 parent b7e2b05 commit c5ca092

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

megatron/training/checkpointing.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,11 +1013,12 @@ def _apply_hybrid_canonicalization_if_applicable(model, model_sd):
10131013
# its module triggers). HybridModel populates these in `__init__`, so
10141014
# their presence is a reliable signal.
10151015
decoder = getattr(unwrapped, 'decoder', None)
1016-
if decoder is None or not hasattr(decoder, 'layer_type_list'):
1017-
return
1018-
if not hasattr(unwrapped, '_decoder_sub_layer_offset'):
1019-
return
1020-
if not hasattr(unwrapped, '_decoder_physical_offset'):
1016+
if (
1017+
decoder is None
1018+
or not hasattr(decoder, 'layer_type_list')
1019+
or not hasattr(unwrapped, '_decoder_sub_layer_offset')
1020+
or not hasattr(unwrapped, '_decoder_physical_offset')
1021+
):
10211022
return
10221023

10231024
canonicalize_hybrid_sharded_state_dict(

0 commit comments

Comments
 (0)