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
I encountered the following error while reproducing your code:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
The specific details are as follows:
Plotting labels...
Image sizes 640 train, 640 val
Using 8 dataloader workers
Logging results to runs/train/exp
Starting training for 300 epochs...
Epoch gpu_mem box obj cls labels img_size
0%| | 0/183 [00:02<?, ?it/s]
Traceback (most recent call last):
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 653, in
main(opt)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 545, in main
train(opt.hyp, opt, device, callbacks)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 333, in train
pred = model(imgs) # forward
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/yolo.py", line 156, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/yolo.py", line 179, in _forward_once
x = m(x) # run
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/common.py", line 150, in forward
x = self.conv(x)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/brevitas/nn/quant_conv.py", line 191, in forward
return self.forward_impl(input)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/brevitas/nn/quant_layer.py", line 311, in forward_impl
output_scale = output_scale * quant_input.scale.view(output_scale_shape)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
Process finished with exit code 1
May I ask if there is a good and effective solution,thanks.
The text was updated successfully, but these errors were encountered:
If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
I encountered the following error while reproducing your code:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
The specific details are as follows:
Plotting labels...
Image sizes 640 train, 640 val
Using 8 dataloader workers
Logging results to runs/train/exp
Starting training for 300 epochs...
0%| | 0/183 [00:02<?, ?it/s]
Traceback (most recent call last):
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 653, in
main(opt)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 545, in main
train(opt.hyp, opt, device, callbacks)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/train.py", line 333, in train
pred = model(imgs) # forward
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/yolo.py", line 156, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/yolo.py", line 179, in _forward_once
x = m(x) # run
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/master21/zhujh/software/pythonProject/quantized-yolov5-quantized_yolo/models/common.py", line 150, in forward
x = self.conv(x)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/brevitas/nn/quant_conv.py", line 191, in forward
return self.forward_impl(input)
File "/home/zhujh/anaconda3/envs/yolov5/lib/python3.7/site-packages/brevitas/nn/quant_layer.py", line 311, in forward_impl
output_scale = output_scale * quant_input.scale.view(output_scale_shape)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
Process finished with exit code 1
May I ask if there is a good and effective solution,thanks.
The text was updated successfully, but these errors were encountered: