mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-04 12:42:51 +08:00
fix Llama lora merge crash
Former-commit-id: c1e2c4ea45ad210e776a192e05e226b34d764135
This commit is contained in:
parent
84c3d509fa
commit
c083708433
@ -64,6 +64,15 @@ def export_model(args: Optional[Dict[str, Any]] = None):
|
||||
for param in model.parameters():
|
||||
param.data = param.data.to(output_dtype)
|
||||
|
||||
# Configuration check and fix
|
||||
config = model.generation_config
|
||||
if config.do_sample and (
|
||||
(config.temperature is not None and config.temperature != 1.0) or
|
||||
(config.top_p is not None and config.top_p != 1.0) or
|
||||
(config.typical_p is not None and config.typical_p != 1.0)
|
||||
):
|
||||
config.do_sample = False
|
||||
|
||||
model.save_pretrained(
|
||||
save_directory=model_args.export_dir,
|
||||
max_shard_size="{}GB".format(model_args.export_size),
|
||||
|
Loading…
x
Reference in New Issue
Block a user