Add current progress to buffer Args: idxs: The index of processed sample added after the last save.
(self, idxs: List[int])
| 45 | self.usage["total"] = total |
| 46 | |
| 47 | def add_progress(self, idxs: List[int]): |
| 48 | """ |
| 49 | Add current progress to buffer |
| 50 | Args: |
| 51 | idxs: The index of processed sample added after the last save. |
| 52 | """ |
| 53 | with self._lock: |
| 54 | if max(idxs) >= self.usage["total"]: |
| 55 | raise Exception(f"Error occurred when add progress to buffer: {idxs} to be added >= total={self.usage['total']}") |
| 56 | self.tmp_add_progress.extend(idxs) |
| 57 | |
| 58 | def load(self, usage_counter: ModelUsageCounter = None) -> Iterable[Any]: |
| 59 | # save the original total from __init__ before loading |