提交 c1da839b 编写于 作者: U u010280923

opt reward model

上级 fa78eeda
......@@ -71,10 +71,12 @@ class RewardModel(pl.LightningModule):
self.padding_embed = nn.Parameter(torch.zeros(dim), requires_grad=False)
# reward 得分计算
self.pred_reward = nn.Sequential(
nn.Linear(dim, 1, bias=False),
Rearrange('... 1 -> ...') # 降维
)
self.pred_reward = nn.Linear(dim, 1, bias=False)
# self.pred_reward = nn.Sequential(
# nn.Linear(dim, 1, bias=False),
# Rearrange('... 1 -> ...') # 降维
# )
def load(self, path):
path = Path(path)
......@@ -177,6 +179,7 @@ class RewardModel(pl.LightningModule):
# 计算奖励
reward = self.pred_reward(last_token_embeds)
reward = reward.squeeze(-1)
return reward
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册