ml4co_kit.utils.time_utils
The utilities used to show progress bar and running time.
Functions
|
Conditionally wraps an iterable with tqdm to display a progress bar. |
Classes
|
A utility class for measuring the execution time of code blocks. |
- class ml4co_kit.utils.time_utils.Timer(apply: bool = True)[source]
Bases:
objectA utility class for measuring the execution time of code blocks. :param apply: boolean, whether to apply the timer on the code blocks. :param start_time: float, the time to mark the start time of code blocks. :param end_time: float, the time to mark the end time of code blocks. :param use_time: float, the time code blocks use.
- ml4co_kit.utils.time_utils.tqdm_by_time(iterable: Iterable[T], desc: str = 'Running', show_time: bool = False) Iterable[T][source]
Conditionally wraps an iterable with tqdm to display a progress bar. :param iterable: iterable object, the input iterable to be processed. :param desc: string, the descriptive text for the progress bar. Defaults to Running. :param show_time: boolean, whether to display a progress bar.