tqdm show progress for a generator I know the length of

You can pass the length to the argument total to make it work.

Example:

from tqdm import tqdm

length = 1000000
generator = (3 * n for n in range(length))  # just doing something random
for n in tqdm(generator, total=length):
    pass