栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【笔记】tqdm 进度条:desc(‘str‘): 传入进度条的前缀,mininterval(float):最小的更新时间 [default: 0.1] sec,set

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【笔记】tqdm 进度条:desc(‘str‘): 传入进度条的前缀,mininterval(float):最小的更新时间 [default: 0.1] sec,set

附:【笔记】python 中 *args 和 **kwargs 的用法:*args 无关键字参数,接收元组、列表;**kwargs 有关键字参数,接收字典_nyist_yangguang的博客-CSDN博客

注: f"{}" 的说明:

eg1:

from tqdm import tqdm
import time
epoch_size=100
Epoch=1000
epoch=45

with tqdm(total=epoch_size, desc=f'Epoch {epoch + 1}/{Epoch}', postfix=dict, mininterval=0.01) as pbar:
    for i in range(10):
        time.sleep(0.5)
        tqdm(total=epoch_size, desc=f'Epoch {epoch + 1}/{Epoch}', postfix=dict,mininterval=1)
        pbar.update(1)

 

 

eg2:

 

eg3:

附:

 跳转中...

from tqdm import tqdm, trange
from random import random, randint
from time import sleep

#trange 是tqdm(range)的简用方式:
for i in trange(int(1e8)):
    pass 

for i in trange(int(1e8),miniters = int(1e6),ascii= True,desc ='bar',colour = 'blue',mininterval = 0.5):
    pass


with trange(10) as t:
    for i in t:
        # Description will be displayed on the left
        t.set_description('GEN %i' % i)
        # Postfix will be displayed on the right,
        # formatted automatically based on argument's datatype
        t.set_postfix(loss=random(), gen=randint(1,999), str='h',
                      lst=[1, 2])
        sleep(0.1)

with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}",
          postfix=["Batch", dict(value=0)]) as t:
    for i in range(10):
        sleep(0.1)
        t.postfix[1]["value"] = i / 2
        t.update()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/321946.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号