Timestamp represents a snapshot of the current training progress. The timestamp measures training progress in terms of iterations, epochs, batches, samples, tokens, and wall clock time. Timestamps are not updated in-place. See the :doc:`Time Guide ` for more details on t
| 459 | |
| 460 | |
| 461 | class Timestamp(Serializable): |
| 462 | """Timestamp represents a snapshot of the current training progress. |
| 463 | |
| 464 | The timestamp measures training progress in terms of iterations, epochs, batches, samples, tokens, and wall clock time. |
| 465 | Timestamps are not updated in-place. |
| 466 | |
| 467 | See the :doc:`Time Guide </trainer/time>` for more details on tracking time during training. |
| 468 | |
| 469 | Args: |
| 470 | iteration (int | Time[int], optional): The iteration. |
| 471 | epoch (int | Time[int], optional): The epoch. |
| 472 | batch (int | Time[int], optional): the batch. |
| 473 | sample (int | Time[int], optional): The sample. |
| 474 | token (int | Time[int], optional): The token. |
| 475 | epoch_in_iteration (int | Time[int], optional): The epoch in the iteration. |
| 476 | token_in_iteration (int | Time[int], optional): The token in the iteration. |
| 477 | batch_in_epoch (int | Time[int], optional): The batch in the epoch. |
| 478 | sample_in_epoch (int | Time[int], optional): The sample in the epoch. |
| 479 | token_in_epoch (int | Time[int], optional): The token in the epoch. |
| 480 | total_wct (datetime.timedelta, optional): The total wall-clock duration. |
| 481 | iteration_wct (datetime.timedelta, optional): The wall-clock duration of the current iteration. |
| 482 | epoch_wct (datetime.timedelta, optional): The wall-clock duration of the current epoch. |
| 483 | batch_wct (datetime.timedelta, optional): The wall-clock duration of the last batch. |
| 484 | """ |
| 485 | |
| 486 | def __init__( |
| 487 | self, |
| 488 | iteration: Union[int, Time[int]] = 0, |
| 489 | epoch: Union[int, Time[int]] = 0, |
| 490 | batch: Union[int, Time[int]] = 0, |
| 491 | sample: Union[int, Time[int]] = 0, |
| 492 | token: Union[int, Time[int]] = 0, |
| 493 | epoch_in_iteration: Union[int, Time[int]] = 0, |
| 494 | token_in_iteration: Union[int, Time[int]] = 0, |
| 495 | batch_in_epoch: Union[int, Time[int]] = 0, |
| 496 | sample_in_epoch: Union[int, Time[int]] = 0, |
| 497 | token_in_epoch: Union[int, Time[int]] = 0, |
| 498 | total_wct: Optional[datetime.timedelta] = None, |
| 499 | iteration_wct: Optional[datetime.timedelta] = None, |
| 500 | epoch_wct: Optional[datetime.timedelta] = None, |
| 501 | batch_wct: Optional[datetime.timedelta] = None, |
| 502 | ): |
| 503 | iteration = Time.from_input(iteration, TimeUnit.ITERATION) |
| 504 | if iteration.unit != TimeUnit.ITERATION: |
| 505 | raise ValueError(f'The `iteration` argument has units of {iteration.unit}; not {TimeUnit.ITERATION}.') |
| 506 | self._iteration = iteration |
| 507 | |
| 508 | epoch = Time.from_input(epoch, TimeUnit.EPOCH) |
| 509 | if epoch.unit != TimeUnit.EPOCH: |
| 510 | raise ValueError(f'The `epoch` argument has units of {epoch.unit}; not {TimeUnit.EPOCH}.') |
| 511 | self._epoch = epoch |
| 512 | |
| 513 | batch = Time.from_input(batch, TimeUnit.BATCH) |
| 514 | if batch.unit != TimeUnit.BATCH: |
| 515 | raise ValueError(f'The `batch` argument has units of {batch.unit}; not {TimeUnit.BATCH}.') |
| 516 | self._batch = batch |
| 517 | |
| 518 | sample = Time.from_input(sample, TimeUnit.SAMPLE) |
no outgoing calls