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

Function get_experiences

tests/buffer/reward_shaping_mapper_test.py:12–29  ·  view source on GitHub ↗

Generate a list of experiences for testing.

(task_num: int, repeat_times: int = 1, step_num: int = 1)

Source from the content-addressed store, hash-verified

10
11
12def get_experiences(task_num: int, repeat_times: int = 1, step_num: int = 1) -> List[Experience]:
13 """Generate a list of experiences for testing."""
14 return [
15 Experience(
16 eid=EID(task=i, run=j, step=k),
17 tokens=torch.zeros((5,)),
18 prompt_length=4,
19 reward=j,
20 logprobs=torch.tensor([0.1]),
21 info={
22 "llm_quality_score": i,
23 "llm_difficulty_score": k,
24 },
25 )
26 for i in range(task_num)
27 for j in range(repeat_times)
28 for k in range(step_num)
29 ]
30
31
32class TestRewardShapingMapper(unittest.IsolatedAsyncioTestCase):

Callers 1

test_basic_usageMethod · 0.70

Calls 2

ExperienceClass · 0.90
EIDClass · 0.90

Tested by

no test coverage detected