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

一直RuntimeError,但是batchsize已经都设为1了。 #3

Open
777Zhao opened this issue Sep 7, 2022 · 6 comments
Open

一直RuntimeError,但是batchsize已经都设为1了。 #3

777Zhao opened this issue Sep 7, 2022 · 6 comments

Comments

@777Zhao
Copy link

777Zhao commented Sep 7, 2022

还有一个result type Float can't be cast to the desired output type __int64错误,请问一下是什么原因呢?

@bubbliiiing
Copy link
Owner

版本呢

@777Zhao
Copy link
Author

777Zhao commented Sep 14, 2022

版本呢

emmm稀里糊涂错误没了~

@zy597337447
Copy link

你好我也出现了类似错误,本地运行可以,但是colab运行报错RuntimeError: result type Float can't be cast to the desired output type long int。是不是pytorch版本问题呢?

@bubbliiiing
Copy link
Owner

是的

@myAstar
Copy link

myAstar commented Nov 22, 2022

你好我也出现了类似错误,本地运行可以,但是colab运行报错RuntimeError: result type Float can't be cast to the desired output type long int。是不是pytorch版本问题呢?

将"yolov7-tiny-pytorch/nets/yolo_training.py"中gain = torch.ones(7, device=targets.device)改为gain = torch.ones(7, device=targets.device).long()即可。原因是新版本的torch无法自动执行此转换,旧版本torch可以。若后面接着出现RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)的错误提示,可以借鉴这篇博客,同样是修改yolo_training.py文件

@bubbliiiing
Copy link
Owner

现在还有么,好像早改了

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

No branches or pull requests

4 participants