!pip list | grep tqdm
tqdm 4.66.4
Benedict Thekkel
100%|██████████████████████████████| 100/100 [00:01<00:00, 96.61it/s]
hello: 100%|████████████████████| 100/100 [00:01<00:00, 95.96epoch/s]
100%|██████████████████████████████| 100/100 [00:01<00:00, 98.61it/s]
100%|██████████████████████████████| 100/100 [00:01<00:00, 98.64it/s]
from multiprocessing import Pool
from tqdm import tqdm
import time
def process_item(item):
time.sleep(0.1) # Simulate some work being done
return item * 2
items = range(100)
# Create a Pool with progress bar
with Pool(processes=4) as pool:
results = list(tqdm(pool.imap(process_item, items), total=len(items)))
100%|██████████████████████████████| 100/100 [00:02<00:00, 39.69it/s]
from tqdm.notebook import tqdm
import time
def callback(pbar):
# Simulate work
pbar.update(1)
def inner_loop(new_bar):
for i in range(total):
time.sleep(0.01)
new_bar.update(1)
new_bar.close()
total = 10
pbar = tqdm(total=total)
for i in range(total):
new_bar = tqdm(total=total, leave=False)
inner_loop(new_bar)
callback(pbar)
pbar.close()