Skip to content

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

Description

@thomasgauvin

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

Activity

github-actions commented on Nov 9, 2020

@github-actions
Contributor

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 commented on Nov 9, 2020

@glenn-jocher
Member

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

glenn-jocher commented on Nov 9, 2020

@glenn-jocher
Member

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

glenn-jocher commented on Nov 9, 2020

@glenn-jocher
Member

thomasgauvin commented on Nov 10, 2020

@thomasgauvin
Author

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

HsLOL commented on Nov 14, 2020

@HsLOL

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 commented on Dec 10, 2020

@littlePrince126

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

github-actions commented on Jan 10, 2021

@github-actions
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleStale and schedule for closing soon

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions