Linked Questions

Popular Questions

Add hint of duration for each iteration in tqdm

Asked by At

I have a list of tasks that each take a different amount of time. Let's say, I have 3 tasks, with durations close to 1x, 5x, 10*x. My tqdm code is something like:

from tqdm import tqdm

def create_task(n):
    def fib(x):
        if x == 1 or x == 0:
            return 1
        return fib(x - 1) + fib(x - 2)
    return lambda: fib(n)

n = 1
tasks = [create_task(n), create_task(5*n), create_task(10*n)]
for task in tqdm(tasks):

The problem is that tqdm thinks each iteration takes the same amount of time. As the first takes approximately 1/10 of the time, the ETA is unreliable.

My question: is it possible to somehow add a hint to tqdm to inform how much each iteration takes compared to the first? Something like informing the duration weights of each iteration...


Related Questions