| 218 | rewards = torch.tensor([0.2, 0.8]) |
| 219 | |
| 220 | class FakeBothModel(torch.nn.Module): |
| 221 | def __init__(self): |
| 222 | super().__init__() |
| 223 | self.calls = 0 |
| 224 | |
| 225 | def forward(self, input_ids, attention_mask=None, use_cache=None): |
| 226 | del attention_mask |
| 227 | assert use_cache is False |
| 228 | self.calls += 1 |
| 229 | return { |
| 230 | "logits": logits[: input_ids.shape[0], : input_ids.shape[1]], |
| 231 | "rewards": rewards, |
| 232 | } |
| 233 | |
| 234 | model = FakeBothModel() |
| 235 | executor = StatelessForwardExecutor(model, StatelessForwardConfig(mode="both")) |
no outgoing calls