Skip to content

No Attribute 'recompute_scale_factor' on Detect/Train #5499

@davidamacey

Description

@davidamacey

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Training, Detection

Bug

Attempted to detect or train on Ubuntu 20.04 with all requirements installed and nightly pytorch installed for my gpu/cuda version.

I have rebuilt multiple venvs with fresh clone of YOLOv5 repo and packages reinstalled. I continue to get this error on device 0 or cpu:

(.trainTEST) user:/mnt/nvm/data/yolov5$ python3 detect.py --source /mnt/nvm/data/yolov5/data/photos_BUCKETS-MODELT
detect: weights=yolov5s.pt, source=/mnt/nvm/data/yolov5/data/photos imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 🚀 v6.0-45-g042f02f torch 1.11.0.dev20211029+cu113 CUDA:0 (NVIDIA GeForce RTX 3080 Ti, 12051.3125MB)

Fusing layers... 
Model Summary: 213 layers, 7225885 parameters, 0 gradients
Traceback (most recent call last):
  File "detect.py", line 306, in <module>
    main(opt)
  File "detect.py", line 301, in main
    run(**vars(opt))
  File "/mnt/nvm/data/yolov5/.trainTEST/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 131, in run
    model(torch.zeros(1, 3, *imgsz).to(device).type_as(next(model.parameters())))  # run once
  File "/mnt/nvm/data/yolov5/.trainTEST/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/nvm/data/yolov5/models/yolo.py", line 127, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/mnt/nvm/data/yolov5/models/yolo.py", line 150, in _forward_once
    x = m(x)  # run
  File "/mnt/nvm/data/yolov5/.trainTEST/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/nvm/data/yolov5/.trainTEST/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 154, in forward
    recompute_scale_factor=self.recompute_scale_factor)
  File "/mnt/nvm/data/yolov5/.trainTEST/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1185, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
(.trainTEST) user:/mnt/nvm/data/yolov5$ pip uninstall torch
Found existing installation: torch 1.11.0.dev20211029+cu113

I used this configuration on Friday with no issues. I did a YOLO rep pull over there weekend and it now displays this error.

Any help or assistance is greatly appreciated!

Environment

YOLOv5 🚀 v6.0-45-g042f02f torch 1.11.0.dev20211029+cu113 CUDA:0 (NVIDIA GeForce RTX 3080 Ti, 12051.3125MB) Ubunte 20.04 Python 3.8.10

Minimal Reproducible Example

python3 detect.py --source

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions