mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-04 04:32:50 +08:00
Merge pull request #900 from mmbwf/main
Fix PPO replace_model loading wrong default parameters. Former-commit-id: 3202985087870f65d639d5f0891ad90d7b39f2ef
This commit is contained in:
commit
fe2ac71d11
@ -10,8 +10,8 @@ if TYPE_CHECKING:
|
||||
def replace_model(model: "AutoModelForCausalLMWithValueHead", target: Literal["default", "reward"]) -> None:
|
||||
if target == "reward": # save default head temporarily
|
||||
valuehead_state_dict = model.v_head.state_dict()
|
||||
setattr(model, "default_head_weight", valuehead_state_dict["summary.weight"])
|
||||
setattr(model, "default_head_bias", valuehead_state_dict["summary.bias"])
|
||||
setattr(model, "default_head_weight", valuehead_state_dict["summary.weight"].clone())
|
||||
setattr(model, "default_head_bias", valuehead_state_dict["summary.bias"].clone())
|
||||
|
||||
model.pretrained_model.set_adapter(target) # set the LoRA adapter to be active
|
||||
model.v_head.load_state_dict({
|
||||
|
Loading…
x
Reference in New Issue
Block a user