You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Predict 报错ValueError: Cannot assign non-leaf Tensor to parameter 'weight'. Model parameters must be created explicitly. To express 'weight' as a function of another Tensor, compute the value in the forward() method.
#58
Open
KeciaHH opened this issue
Apr 15, 2024
· 2 comments
File "/home/hhee/Desktop/yolov8-pytorch/predict.py", line 91, in
r_image = yolo.detect_image(image, crop = crop, count=count)
File "/home/hhee/Desktop/yolov8-pytorch/yolo.py", line 144, in detect_image outputs = self.net(images)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 170, in forward
replicas = self.replicate(self.module, self.device_ids[:len(inputs)])
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 175, in replicate
return replicate(module, device_ids, not torch.is_grad_enabled())
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/replicate.py", line 148, in replicate
setattr(replica, key, param)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1632, in setattr
self.register_parameter(name, value)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 573, in register_parameter
raise ValueError(
ValueError: Cannot assign non-leaf Tensor to parameter 'weight'. Model parameters must be created explicitly. To express 'weight' as a function of another Tensor, compute the value in the forward() method.
加载权重成功了,infer报错
The text was updated successfully, but these errors were encountered:
File "/home/hhee/Desktop/yolov8-pytorch/predict.py", line 91, in
r_image = yolo.detect_image(image, crop = crop, count=count)
File "/home/hhee/Desktop/yolov8-pytorch/yolo.py", line 144, in detect_image
outputs = self.net(images)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 170, in forward
replicas = self.replicate(self.module, self.device_ids[:len(inputs)])
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 175, in replicate
return replicate(module, device_ids, not torch.is_grad_enabled())
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/parallel/replicate.py", line 148, in replicate
setattr(replica, key, param)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1632, in setattr
self.register_parameter(name, value)
File "/home/hhee/anaconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 573, in register_parameter
raise ValueError(
ValueError: Cannot assign non-leaf Tensor to parameter 'weight'. Model parameters must be created explicitly. To express 'weight' as a function of another Tensor, compute the value in the forward() method.
加载权重成功了,infer报错
The text was updated successfully, but these errors were encountered: