@@ -67,6 +67,7 @@ def convert_mcore2hf(self) -> None:
6767 shutil .copy (args_path , os .path .join (args .save , 'args.json' ))
6868 else :
6969 args .save_args (args .save )
70+ logger .info (f'Successfully saved HF model weights in `{ args .save } `.' )
7071 if args .test_convert_precision :
7172 with disable_safe_ddp_context_use_barrier ():
7273 if save_peft_format :
@@ -114,13 +115,18 @@ def convert_hf2mcore(self) -> None:
114115 logger .info ('Merge LoRA...' )
115116 mg_model = peft_model .merge_and_unload ()
116117 logger .info ('Successfully transferred HF model weights to MG model.' )
118+ # hf_model does not support loading args.adapter_load, so test_convert_precision cannot be performed
119+ support_convert_precision = args .adapter_load is None
117120 if args .test_convert_precision :
118- with disable_safe_ddp_context_use_barrier ():
119- device_map = args .device_map or 'auto'
120- hf_model , template = prepare_model_template (
121- args , device_map = device_map ) if is_last_rank () else (None , template )
122- test_convert_precision (hf_model , mg_model , template , args .test_convert_dtype )
123- dist .barrier ()
121+ if support_convert_precision :
122+ with disable_safe_ddp_context_use_barrier ():
123+ device_map = args .device_map or 'auto'
124+ hf_model , template = prepare_model_template (
125+ args , device_map = device_map ) if is_last_rank () else (None , template )
126+ test_convert_precision (hf_model , mg_model , template , args .test_convert_dtype )
127+ dist .barrier ()
128+ else :
129+ logger .warning ('Skip test_convert_precision because `--adapter_load` is specified.' )
124130 args .save_args (args .save )
125131 logger .info ('Saving the model...' )
126132 save_peft_format = args .train_type == 'lora' and not args .merge_lora
0 commit comments