MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / main

Function main

scripts/merge_model.py:13–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 return parser.parse_args()
12
13def main():
14 script_args = args()
15 model_for_merge = AutoModelForCausalLM.from_pretrained(
16 script_args.base_model_path_or_name,
17 torch_dtype=torch.float16,
18 )
19 tokenizer = AutoTokenizer.from_pretrained(script_args.base_model_path_or_name, trust_remote_code=True)
20 full_model = PeftModel.from_pretrained(model_for_merge,
21 model_id=script_args.adapter_dir,
22 )
23 full_model = full_model.base_model.merge_and_unload()
24 full_model.save_pretrained(script_args.full_model_dir)
25 tokenizer.save_pretrained(script_args.full_model_dir)
26
27if __name__ == "__main__":
28 main()

Callers 1

merge_model.pyFile · 0.70

Calls 1

argsFunction · 0.85

Tested by

no test coverage detected