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)
| 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.""" |