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

Docker image is not working, torch.nn.modules.module.ModuleAttributeError: 'Hardswish' object has no attribute 'inplace' #1327

Closed
thomasgauvin opened this issue Nov 9, 2020 · 8 comments
Labels

Comments

@thomasgauvin
Copy link

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.
Attempting to run the ultralytics/yolov5:latest docker image results in torch.nn.modules.module.ModuleAttributeError: 'Hardswish' object has no attribute 'inplace'

To Reproduce (REQUIRED)

run python detect.py ...

Output:

  File "/root/Video-Streaming/computer_vision/yolov5_mod/models/yolo.py", line 118, in forward
    return self.forward_once(x, profile)  # single-scale inference, train
  File "/root/Video-Streaming/computer_vision/yolov5_mod/models/yolo.py", line 138, in forward_once
    x = m(x)  # run
  File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/Video-Streaming/computer_vision/yolov5_mod/models/common.py", line 92, 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/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/Video-Streaming/computer_vision/yolov5_mod/models/common.py", line 36, in fuseforward
    return self.act(self.conv(x))
  File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/activation.py", line 438, in forward
    return F.hardswish(input, self.inplace)
  File "/opt/conda/lib/python3.6/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

It should run and begin analyzing the video frames

Environment

If applicable, add screenshots to help explain your problem.

  • OS: Docker
  • GPU 1080 Ti
@thomasgauvin thomasgauvin added the bug Something isn't working label Nov 9, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2020

Hello @thomasgauvin, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

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 model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher glenn-jocher removed the bug Something isn't working label Nov 9, 2020
@glenn-jocher
Copy link
Member

Docker image operates correctly. Just pulled latest and tested today:
Screenshot 2020-11-09 at 20 52 56

@glenn-jocher
Copy link
Member

GPU mode operates correctly also:
Screenshot 2020-11-09 at 20 55 25

@glenn-jocher
Copy link
Member

glenn-jocher commented Nov 9, 2020

@thomasgauvin
Copy link
Author

Thank you for the response @glenn-jocher, I will try it again perhaps there is something wrong with my configurations

@HsLOL
Copy link

HsLOL commented Nov 14, 2020

hello @thomasgauvin
I also have the same problem when I run the detect.py
The error is "torch.nn.modules.module.ModuleAttributeError: 'Hardswish' object has no attribute 'inplace'"
Have you solved this problem? If you solved this problem,what's your configurations?

thank you!

@littlePrince126
Copy link

@HsLOL Using torch-1.6.0 with torchvision-0.7.0 could slove this problem

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants