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

Method read_batch

trinity/buffer/reader/file_reader.py:64–78  ·  view source on GitHub ↗
(self, batch_size: int)

Source from the content-addressed store, hash-verified

62 self.progress_bar.update(self.current_offset)
63
64 def read_batch(self, batch_size: int) -> Tuple[List, List]:
65 batch, indices = [], []
66 while len(batch) < batch_size:
67 if self.current_offset >= self.total_samples:
68 if not self.drop_last and len(batch) > 0:
69 break
70 self.progress_bar.close()
71 raise StopIteration
72 index = self.current_offset % self.dataset_size
73 batch.append(self.dataset[index])
74 indices.append(index)
75 self.current_offset += 1
76
77 self.progress_bar.update(len(batch))
78 return batch, indices
79
80 def select_batch(self, indices: List[int]) -> List:
81 batch = []

Callers 1

_read_samplesMethod · 0.80

Calls 2

closeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected