ultralytics / yolov3

YOLOv3 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
10.18k stars 3.44k forks source link

RuntimeError: set_storage is not allowed on Tensor created from .data or .detach() #353

Closed haoran1062 closed 5 years ago

haoran1062 commented 5 years ago

pytorch1.1 cuda9.0, run train get error:

Model Summary: 222 layers, 6.15291e+07 parameters, 6.15291e+07 gradients

   Epoch       Batch        xy        wh      conf       cls     total  nTargets      time
Traceback (most recent call last):
  File "train.py", line 308, in <module>
    multi_scale=opt.multi_scale,
  File "train.py", line 184, in train
    pred = model(imgs)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/parallel/distributed.py", line 360, in forward
    self._sync_params()
  File "/root/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/parallel/distributed.py", line 392, in _sync_params
    param_data.set_(tensor)
RuntimeError: set_storage is not allowed on Tensor created from .data or .detach()
glenn-jocher commented 5 years ago

Hello, thank you for your interest in our work! This is an automated response. Please note that most technical problems are due to:

If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!

ZhxJia commented 5 years ago

i got the same error ,how to solve it?

glenn-jocher commented 11 months ago

@ZhxJia this runtime error is typically caused by attempting to modify a tensor that has been created using the .data or .detach() method. To resolve this, ensure that you are not directly modifying tensors created from .data or .detach() and instead modify the original tensor before creating the detached version.

If you need further assistance, please provide more details about the specific situation in which this error occurs, such as relevant code snippets or a description of the training process, so that I can offer more targeted guidance.