support GPTQ tuning #729 #1481 #1545 , fix chatglm template #1453 #1480 #1569

Former-commit-id: fdccc6cc9b68890199e9250cabdb996ff2f853b9
This commit is contained in:
hiyouga
2023-11-20 22:52:11 +08:00
parent 28258aecd2
commit 0105cd48f2
5 changed files with 43 additions and 4 deletions

View File

@@ -65,7 +65,12 @@ def init_adapter(
checkpoint_to_resume = None
if model_args.checkpoint_dir is not None:
if is_trainable and finetuning_args.resume_lora_training:
is_mergeable = True
if getattr(model, "quantization_method", None) == "gptq":
assert len(model_args.checkpoint_dir) == 1, "GPTQ quantized model only accepts a single checkpoint."
is_mergeable = False
if (is_trainable and finetuning_args.resume_lora_training) or (not is_mergeable):
checkpoints_to_merge, checkpoint_to_resume = model_args.checkpoint_dir[:-1], model_args.checkpoint_dir[-1]
else:
checkpoints_to_merge = model_args.checkpoint_dir