MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / run

Method run

trinity/common/workflows/math_rm_workflow.py:28–50  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26 )
27
28 def run(self) -> List[Experience]:
29 messages = self.format_messages()
30
31 self.logger.debug("start chat")
32 responses = self.model.chat(messages, **self.rollout_args)
33 for i, response in enumerate(responses):
34 reward_dict = self.reward_fn( # type: ignore
35 response,
36 messages,
37 ground_truth=self.truth,
38 )
39
40 if response.metrics is None:
41 response.metrics = {}
42 response.metrics.update(reward_dict)
43 reward = sum(reward_dict.values())
44 response.reward = reward
45 response.eid.run = i + self.run_id_base
46
47 self.logger.debug(
48 f"self.task_desc: {self.task_desc}, messages: {messages}, response: {response.response_text}, reward: {reward}"
49 )
50 return responses
51
52
53class AsyncMathRMWorkflow(MathRMWorkflow):

Callers

nothing calls this directly

Calls 5

debugMethod · 0.80
reward_fnMethod · 0.80
format_messagesMethod · 0.45
chatMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected