Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reward Model 推理 #7212

Open
1 task done
SFTJBD opened this issue Mar 7, 2025 · 0 comments
Open
1 task done

Reward Model 推理 #7212

SFTJBD opened this issue Mar 7, 2025 · 0 comments
Labels
bug Something isn't working pending This problem is yet to be addressed

Comments

@SFTJBD
Copy link

SFTJBD commented Mar 7, 2025

Reminder

  • I have read the above rules and searched the existing issues.

System Info

有没有具体的 reward model 在训练完成后的推理的示例。需要什么样的数据,用哪个指令可以进行rm的推理?我现在将lora模型加载后,计算的score不知道是不是正确。

Reproduction

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_path_merge_rm, device_map="cpu")
model = AutoModelForCausalLMWithValueHead.from_pretrained(model)
vhead_params = load_valuehead_params(vhead_file)
model.load_state_dict(vhead_params, strict=False)

_, _, values = model(**inputs, output_hidden_states=True, return_dict=True, use_cache=False)
rewards = values.gather(dim=-1, index=(inputs["attention_mask"].sum(dim=-1, keepdim=True) - 1))

Others

No response

@SFTJBD SFTJBD added bug Something isn't working pending This problem is yet to be addressed labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending This problem is yet to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant