pydvl.utils.progress
¶
Progress
¶
Progress(iterable: Iterable[T], is_done: StoppingCriterion, **kwargs: Any)
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.
-
TYPE:
|
Source code in src/pydvl/utils/progress.py
repeat_indices
¶
repeat_indices(
indices: Collection[int],
result: ValuationResult,
done: StoppingCriterion,
**kwargs: Any,
) -> 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.
TYPE:
|
Source code in src/pydvl/utils/progress.py
log_duration
¶
log_duration(_func=None, *, log_level=DEBUG)
Decorator to log execution time of a function with a configurable logging level. It can be used with or without specifying a log level.