Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch1.7 is not completely support.'inplace'! 'inplace'! 'inplace'! #1832

Closed
cww97 opened this issue Jan 4, 2021 · 3 comments
Closed

pytorch1.7 is not completely support.'inplace'! 'inplace'! 'inplace'! #1832

cww97 opened this issue Jan 4, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@cww97
Copy link

cww97 commented Jan 4, 2021

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:

If this is a custom dataset/training question you must include your train*.jpg, test*.jpg and results.png figures, or we can not help you. You can generate these with utils.plot_results().

🐛 Bug

A clear and concise description of what the bug is.

your requirements.txt said pytorch>=1.7, on cpu this is fine, but when I ran it on GPU, yeah, boom
I fixed it from [here](https://github.com/ultralytics/yolov5/issues/1265#issuecomment-723497340),
yes, downgrade pytorch into 1.6.

To Reproduce (REQUIRED)

Input:

$ python detect.py --source ./inference/images/ --weights yolov5s.pt --conf 0.4

Output:

Traceback (most recent call last):
  File "detect.py", line 188, in <module>
    detect()
  File "detect.py", line 69, in detect
    _ = model(img.half() if half else img) if device.type != 'cpu' else None  # run once
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/chenweiwen/sec-model-code/yolov5/models/yolo.py", line 112, in forward
    return self.forward_once(x, profile)  # single-scale inference, train
  File "/opt/chenweiwen/sec-model-code/yolov5/models/yolo.py", line 132, in forward_once
    x = m(x)  # run
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/chenweiwen/sec-model-code/yolov5/models/common.py", line 88, in forward
    return self.conv(torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1))
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/chenweiwen/sec-model-code/yolov5/models/common.py", line 32, in fuseforward
    return self.act(self.conv(x))
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/activation.py", line 438, in forward
    return F.hardswish(input, self.inplace)
  File "/opt/chenweiwen/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in __getattr__
    type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'Hardswish' object has no attribute 'inplace'

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [centOS 7]
  • GPU [Tesla M60]

Additional context

Add any other context about the problem here.

@cww97 cww97 added the bug Something isn't working label Jan 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2021

👋 Hello @cww97, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

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.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

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), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

@cww97 our Colab notebook runs 1.7.0 on GPU perfectly well. Everything is working correctly on all OSs if you meet the requirements.

Screen Shot 2021-01-04 at 9 25 50 PM

@wwdok
Copy link
Contributor

wwdok commented Jan 7, 2021

You don't have to downgrade torch version, just refer to this, it works for me !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants