python - models.vgg16(pretrained=True) 由于 TqdmKeyError:“未知参数:{'unit_divisor': 1024}”
问题描述
我正在尝试运行:models.vgg16(pretrained=True) 并获得 pytorch 的预保留模型,但我得到了一个错误,这个错误之前已经被问过 - 但那里的回答对我没有帮助:/
我尝试升级 tqdm 和 twine 但没有成功。
谢谢..
完整日志:
TqdmKeyError Traceback
(most recent call last)
<ipython-input-13-f93ae0d83650> in <module>
2 from torchvision import transforms, datasets, models
3
----> 4 model = models.vgg16(pretrained=True)
5
6 # n_inputs = model.classifier[6].in_features
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\torchvision\models\vgg.py in vgg16(pretrained, progress, **kwargs)
148 progress (bool): If True, displays a progress bar of the download to stderr
149 """
--> 150 return _vgg('vgg16', 'D', False, pretrained, progress, **kwargs)
151
152
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\torchvision\models\vgg.py in _vgg(arch, cfg, batch_norm, pretrained, progress, **kwargs)
91 if pretrained:
92 state_dict = load_state_dict_from_url(model_urls[arch],
---> 93 progress=progress)
94 model.load_state_dict(state_dict)
95 return model
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\torch\hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash, file_name)
553 r = HASH_REGEX.search(filename) # r is Optional[Match[str]]
554 hash_prefix = r.group(1) if r else None
--> 555 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
556
557 if _is_legacy_zip_format(cached_file):
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\torch\hub.py in download_url_to_file(url, dst, hash_prefix, progress)
443 sha256 = hashlib.sha256()
444 with tqdm(total=file_size, disable=not progress,
--> 445 unit='B', unit_scale=True, unit_divisor=1024) as pbar:
446 while True:
447 buffer = u.read(8192)
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\tqdm\_tqdm.py in __init__(self, iterable, desc, total, leave, file, ncols, mininterval, maxinterval, miniters, ascii, disable, unit, unit_scale, dynamic_ncols, smoothing, bar_format, initial, position, postfix, gui, **kwargs)
TqdmKeyError: "Unknown argument(s): {'unit_divisor': 1024}"
解决方案
推荐阅读
- typescript - 打字稿为嵌套的可选对象类型创建默认值
- android - 按下时图像应该缩小,反之亦然,当按下时它应该回到原来的位置。在安卓音频中
- javascript - 更改关于 discord.js 中图像的页脚
- cmake - target_link_libraries:PRIVATE|PUBLIC|INTERFACE 的默认设置
- python-3.x - elasticsearch5的身份验证异常
- system.reactive - 如何实现你自己的合并操作符,它可以正确地合并冷的 observables
- docker - docker-compose 等待启动,直到挂载主机文件系统
- python - 规范化python
- javascript - 外层 div 有点击功能,内层 div 没有
- python - 如何以矢量化形式计算这种乘法?