Hi all,
I am a beginner of PyTorch and try to master the PyTorch library.
I met a problem about pretrained model loading with the following codes:
import torchvision.models as models
resnet18 = models.resnet18(pretrained=True)
The error information is listed as follows:
Downloading: "https://download.pytorch.org/models/resnet18-5c106cde.pth" to /home/xxx/.cache/torch/checkpoints/resnet18-5c106cde.pth
---------------------------------------------------------------------------
TqdmKeyError Traceback (most recent call last)
<ipython-input-1-ca5a1cdda949> in <module>
1 import torchvision.models as models
----> 2 resnet18 = models.resnet18(pretrained=True)
3 #resnet18 = models.resnet18()
~/.conda/envs/wzh/lib/python3.6/site-packages/torchvision/models/resnet.py in resnet18(pretrained, progress, **kwargs)
229 """
230 return _resnet('resnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress,
--> 231 **kwargs)
232
233
~/.conda/envs/wzh/lib/python3.6/site-packages/torchvision/models/resnet.py in _resnet(arch, block, layers, pretrained, progress, **kwargs)
215 if pretrained:
216 state_dict = load_state_dict_from_url(model_urls[arch],
--> 217 progress=progress)
218 model.load_state_dict(state_dict)
219 return model
~/.conda/envs/wzh/lib/python3.6/site-packages/torch/hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash)
483 sys.stderr.write('Downloading: "{}" to {}\n'.format(url, cached_file))
484 hash_prefix = HASH_REGEX.search(filename).group(1) if check_hash else None
--> 485 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
486
487 # Note: extractall() defaults to overwrite file if exists. No need to clean up beforehand.
~/.conda/envs/wzh/lib/python3.6/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)
402 sha256 = hashlib.sha256()
403 with tqdm(total=file_size, disable=not progress,
--> 404 unit='B', unit_scale=True, unit_divisor=1024) as pbar:
405 while True:
406 buffer = u.read(8192)
~/.local/lib/python3.6/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)
660 """, fp_write=getattr(file, 'write', sys.stderr.write))
661 if "nested" in kwargs else
--> 662 TqdmKeyError("Unknown argument(s): " + str(kwargs)))
663
664 # Preprocess the arguments
TqdmKeyError: "Unknown argument(s): {'unit_divisor': 1024}"
If I removed “pretrained=True”, the codes work normally. I tried to google the error information, but no useful information returned. Could you please help me about this error? Thanks