-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PROD-290: Show DGAN training progress
GitOrigin-RevId: 6d0e6c5c09286940c7ec71bc3810d2159cc3df06
- Loading branch information
Showing
2 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Auxiliary datastructures for DGAN | ||
""" | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
|
||
@dataclass | ||
class ProgressInfo: | ||
"""Information about DGAN training progress. | ||
Args: | ||
epoch: the current epoch, zero-based. | ||
total_epochs: the total number of epochs. | ||
batch: the current batch within the current epoch, zero-based. | ||
total_batches: the total number of batches in this epoch. | ||
""" | ||
|
||
epoch: int | ||
total_epochs: int | ||
batch: int | ||
total_batches: int | ||
|
||
@property | ||
def frac_completed(self) -> float: | ||
""" | ||
An estimation of which fraction of the overall task is completed. | ||
Returns: | ||
A number between 0.0 and 1.0 indicating which fraction of the task is completed. | ||
""" | ||
return ( | ||
self.epoch + 1 + float(self.batch + 1) / self.total_batches | ||
) / self.total_epochs |