From 2a36fd5064f028f394ac07c25440fd5e965a07b8 Mon Sep 17 00:00:00 2001 From: hiyouga Date: Mon, 20 Nov 2023 19:01:37 +0800 Subject: [PATCH] fix value head model resuming --- src/llmtuner/model/loader.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/llmtuner/model/loader.py b/src/llmtuner/model/loader.py index 18a33043..14ea7095 100644 --- a/src/llmtuner/model/loader.py +++ b/src/llmtuner/model/loader.py @@ -202,6 +202,7 @@ def load_model_and_tokenizer( if stage in ["rm", "ppo"]: model: "AutoModelForCausalLMWithValueHead" = AutoModelForCausalLMWithValueHead.from_pretrained(model) setattr(model, "_keys_to_ignore_on_save", [name for name, _ in model.named_parameters() if "pretrained_model" in name]) + setattr(model, "tie_weights", MethodType(lambda _: None, model)) vhead_path = ( model_args.checkpoint_dir[-1] if model_args.checkpoint_dir is not None else model_args.model_name_or_path )