yolov7 icon indicating copy to clipboard operation
yolov7 copied to clipboard

'Upsample' object has no attribute 'recompute_scale_factor'

Open lister2000 opened this issue 2 years ago • 7 comments

AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

lister2000 avatar Aug 16 '22 02:08 lister2000

This is cause by different version of pytorch. solution

WongKinYiu avatar Aug 16 '22 07:08 WongKinYiu

非常惊喜和意外能收到老师用邮件回复我在github提的问题,按照您提示的方法更换pytorch版本后已经可以运行正常yolov7。 此刻心情激动的心情,千里之外一句谢谢希望能收到。

Re:Re: [WongKinYiu/yolov7] 'Upsample' object has no attribute 'recompute_scale_factor' (Isxisue #520)

At 2022-08-16 15:52:50, "Kin-Yiu, Wong" @.***> wrote:

This is cause by different version of pytorch. solution

—7 Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

lister2000 avatar Aug 23 '22 01:08 lister2000

This is cause by different version of pytorch. solution

The solution is empty now, my torch version is 1.12.0 + cu10.2, need i downgrade my torch?

Darrenxc avatar Aug 23 '22 02:08 Darrenxc

https://github.com/WongKinYiu/yolov7/blob/main/models/experimental.py#L249-L250 https://github.com/WongKinYiu/yolov7/blob/u5/models/yolo.py#L224-L226

WongKinYiu avatar Aug 23 '22 02:08 WongKinYiu

for those who have this problem, you can follow this https://github.com/ultralytics/yolov5/issues/6948#issuecomment-1075548218

Darrenxc avatar Aug 23 '22 02:08 Darrenxc

@WongKinYiu Looking at the experimental.py in 249 it says # torch 1.11.0 compatibility. What about for torch 1.12.1 which is the latest version on pytorch.

JerolSOIBAM avatar Aug 23 '22 15:08 JerolSOIBAM

I downgraded my pytorch version to 1.11.0 but still faced this error, I downgraded pytorch to 1.10.1 and it solved the error. I used this command specifically: "conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge"

afzixhaikh avatar Sep 17 '22 05:09 afzixhaikh

The issue is solved temporarily by downgrading PyTorch to 1.10.1 as @afzixhaikh mentioned above.

halmusaibeli avatar Oct 08 '22 03:10 halmusaibeli