pydvl.utils.progress
¶
Progress
¶
Progress(iterable: Iterable[T], is_done: StoppingCriterion, **kwargs)
Bases: Generic[T]
Displays an optional progress bar for an iterable, using StoppingCriterion.completion for the progress.
PARAMETER | DESCRIPTION |
---|---|
iterable |
The iterable to wrap.
TYPE:
|
is_done |
The stopping criterion.
TYPE:
|
kwargs |
Additional keyword arguments passed to tqdm.
-
DEFAULT:
|
Source code in src/pydvl/utils/progress.py
repeat_indices
¶
repeat_indices(
indices: Collection[int],
result: "ValuationResult",
done: "StoppingCriterion",
**kwargs
) -> Iterator[int]
Helper function to cycle indefinitely over a collection of indices until the stopping criterion is satisfied while displaying progress.
PARAMETER | DESCRIPTION |
---|---|
indices |
Collection of indices that will be cycled until done.
TYPE:
|
result |
Object containing the current results.
TYPE:
|
done |
Stopping criterion.
TYPE:
|
kwargs |
Keyword arguments passed to tqdm.
DEFAULT:
|
Source code in src/pydvl/utils/progress.py
log_duration
¶
Decorator to log execution time of a function with a configurable logging level. It can be used with or without specifying a log level.