You can pass the length to the argument total to make it work.
Example:
from tqdm import tqdmlength = 1000000generator = (3 * n for n in range(length)) # just doing something randomfor n in tqdm(generator, total=length): pass