用法1:
代码:
from tqdm import tqdm
import time
for i in tqdm(range(100)):
time.sleep(0.01)
结果:
用法2
代码:
from tqdm import trange
epoch = 10
n_batches = 10000
with tqdm(total=n_batches, desc='Train epoch %d' % epoch) as train_enum:
for batch_num in range(n_batches):
batch_loss = 3.25
train_enum.set_description(f'Train (loss: {batch_loss:.2f}) epoch {epoch}')
train_enum.update()
结果:
参考链接
python的Tqdm模块
https://github.com/tqdm/tqdm/tree/master/examples
https://pypi.python.org/pypi/tqdm
https://github.com/tqdm/tqdm