MCPcopy Create free account
hub / github.com/RL-Align/RL-Kernel / FakeRewardModel

Class FakeRewardModel

tests/test_stateless_executor.py:50–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49
50class FakeRewardModel(torch.nn.Module):
51 def __init__(self, rewards: torch.Tensor):
52 super().__init__()
53 self.register_buffer("fixed_rewards", rewards)
54 self.use_cache_calls: list[bool | None] = []
55
56 def forward(self, input_ids, attention_mask=None, use_cache=None):
57 del attention_mask
58 self.use_cache_calls.append(use_cache)
59 return {"logits": self.fixed_rewards[: input_ids.shape[0]].unsqueeze(-1)}
60
61
62class NoUseCacheModel(torch.nn.Module):

Calls

no outgoing calls