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

Method _sample_data

trinity/trainer/trainer.py:193–203  ·  view source on GitHub ↗

Sample a batch of experiences. Returns: List[Experience]: A batch of experiences. Dict: Metrics of the sampling step. List[Dict]: A list of representative samples for logging.

(self)

Source from the content-addressed store, hash-verified

191 return metrics
192
193 async def _sample_data(self) -> Tuple[List[Experience], Dict, List[Dict]]:
194 """Sample a batch of experiences.
195
196 Returns:
197 List[Experience]: A batch of experiences.
198 Dict: Metrics of the sampling step.
199 List[Dict]: A list of representative samples for logging.
200 """
201 batch, metrics, repr_samples = await self.sample_strategy.sample(self.train_step_num + 1)
202 metrics["sample/task_count"] = len(set(exp.eid.tid for exp in batch))
203 return batch, metrics, repr_samples
204
205 async def need_sync(self) -> bool:
206 """Whether to sync the model weight."""

Callers 1

trainMethod · 0.95

Calls 1

sampleMethod · 0.45

Tested by

no test coverage detected