RuntimeError Traceback (most recent call last)
Cell In[31], line 3
1 #object of model selection class
----> 3 img2vec = Img2Vec(cuda=False, model=‘efficientnet_b0’)
4 #img2vec = Img2Vec(cuda=False, model=‘vit_base_patch16_224’, layer=‘head’)
Cell In[28], line 35, in Img2Vec.init(self, cuda, model, layer, layer_output_size, gpu)
32 self.layer_output_size = layer_output_size
33 self.model_name = model
—> 35 self.model, self.extraction_layer = self._get_model_and_layer(model, layer)
37 self.model = self.model.to(self.device)
39 self.model.eval()
Cell In[28], line 176, in Img2Vec._get_model_and_layer(self, model_name, layer)
173 elif “efficientnet” in model_name:
174 # efficientnet-b0 ~ efficientnet-b7
175 if model_name == “efficientnet_b0”:
→ 176 model = models.efficientnet_b0(pretrained=True)
177 elif model_name == “efficientnet_b1”:
178 model = models.efficientnet_b1(pretrained=True)
File C:\Anaconda\lib\site-packages\torchvision\models_utils.py:142, in kwonly_to_pos_or_kw..wrapper(*args, **kwargs)
135 warnings.warn(
136 f"Using {sequence_to_str(tuple(keyword_only_kwargs.keys()), separate_last='and ')} as positional "
137 f"parameter(s) is deprecated since 0.13 and may be removed in the future. Please use keyword parameter(s) "
138 f"instead."
139 )
140 kwargs.update(keyword_only_kwargs)
→ 142 return fn(*args, **kwargs)
File C:\Anaconda\lib\site-packages\torchvision\models_utils.py:228, in handle_legacy_interface..outer_wrapper..inner_wrapper(*args, **kwargs)
225 del kwargs[pretrained_param]
226 kwargs[weights_param] = default_weights_arg
→ 228 return builder(*args, **kwargs)
File C:\Anaconda\lib\site-packages\torchvision\models\efficientnet.py:770, in efficientnet_b0(weights, progress, **kwargs)
767 weights = EfficientNet_B0_Weights.verify(weights)
769 inverted_residual_setting, last_channel = _efficientnet_conf(“efficientnet_b0”, width_mult=1.0, depth_mult=1.0)
→ 770 return _efficientnet(
771 inverted_residual_setting, kwargs.pop(“dropout”, 0.2), last_channel, weights, progress, **kwargs
772 )
File C:\Anaconda\lib\site-packages\torchvision\models\efficientnet.py:360, in _efficientnet(inverted_residual_setting, dropout, last_channel, weights, progress, **kwargs)
357 model = EfficientNet(inverted_residual_setting, dropout, last_channel=last_channel, **kwargs)
359 if weights is not None:
→ 360 model.load_state_dict(weights.get_state_dict(progress=progress, check_hash=True))
362 return model
File C:\Anaconda\lib\site-packages\torchvision\models_api.py:90, in WeightsEnum.get_state_dict(self, *args, **kwargs)
89 def get_state_dict(self, *args: Any, **kwargs: Any) → Mapping[str, Any]:
—> 90 return load_state_dict_from_url(self.url, *args, **kwargs)
File C:\Anaconda\lib\site-packages\torch\hub.py:757, in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash, file_name, weights_only)
755 r = HASH_REGEX.search(filename) # r is Optional[Match[str]]
756 hash_prefix = r.group(1) if r else None
→ 757 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
759 if _is_legacy_zip_format(cached_file):
760 return _legacy_zip_load(cached_file, model_dir, map_location, weights_only)
File C:\Anaconda\lib\site-packages\torch\hub.py:653, in download_url_to_file(url, dst, hash_prefix, progress)
651 digest = sha256.hexdigest()
652 if digest[:len(hash_prefix)] != hash_prefix:
→ 653 raise RuntimeError(‘invalid hash value (expected “{}”, got “{}”)’
654 .format(hash_prefix, digest))
655 shutil.move(f.name, dst)
656 finally:
RuntimeError: invalid hash value (expected “3dd342df”, got “7f5810bc96def8f7552d5b7e68d53c4786f81167d28291b21c0d90e1fca14934”)