Skip to content

Commit 75ff245

Browse files
committed
addressing a comment
1 parent e33e658 commit 75ff245

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/by_feature/megatron_lm_gpt_pretraining.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,8 @@ def main():
379379
if args.model_name_or_path:
380380
# if we are using Megatron-LM, we can use init_empty_weights to load the model without initializing the weights
381381
# since the weights are loaded later.
382-
if accelerator.distributed_type == DistributedType.MEGATRON_LM:
382+
if args.resume_from_checkpoint is not None or args.initial_megatron_lm_checkpoint is not None:
383383
assert config is not None, "config should not be None for Megatron-LM"
384-
assert args.resume_from_checkpoint is not None or args.initial_megatron_lm_checkpoint is not None, "resume_from_checkpoint or initial_megatron_lm_checkpoint should be provided for Megatron-LM since we need to load the weights from the checkpoint later on"
385384
with init_empty_weights():
386385
model = AutoModelForCausalLM.from_config(config)
387386
else:

0 commit comments

Comments
 (0)