首页 Paddle框架 帖子详情
多卡训练就报这个错是为什么?
收藏
快速回复
Paddle框架 问答深度学习 4130 18
多卡训练就报这个错是为什么?
收藏
快速回复
Paddle框架 问答深度学习 4130 18

单卡训练时可以,但是多卡训练就报这个错:

RuntimeError: (PreconditionNotMet) A serious error has occurred here. Please set find_unused_parameters=True to traverse backward graph in each step to prepare reduce in advance. If you have set, There may be several reasons for this error: 1) Please note that all forward outputs derived from the module parameters must participate in the calculation of losses and subsequent gradient calculations. If not, the wrapper will hang, waiting for autograd to generate gradients for these parameters. you can use detach or stop_gradient to make the unused parameters detached from the autograd graph. 2) Used multiple forwards and one backward. You may be able to wrap multiple forwards in a model.

请问是怎么回事?

0
收藏
回复
全部评论(18)
时间顺序
UnseenMe
#2 回复于2021-07

可以考虑换成静态图再试一试。

0
回复
FutureSI
#3 回复于2021-07

难道单卡下可以某个网络不更新权重,而多卡下就不行了么?

0
回复
FutureSI
#4 回复于2021-07

我的GAN模型里用的一个辅助vgg网络是用的预训练参数,不进行参数更新

0
回复
FutureSI
#5 回复于2021-07
可以考虑换成静态图再试一试。

那可是个大动作

0
回复
UnseenMe
#6 回复于2021-07
我的GAN模型里用的一个辅助vgg网络是用的预训练参数,不进行参数更新

貌似这种情况,需要把VGG放到GAN模型里面去。

也就是说不可以有多个模型。

0
回复
trainer
#7 回复于2021-07

我在使用paddledetection2.1时遇到过同样问题,技术人员给出的解决方法实在config中加入

find_unused_parameters: true

在pddet中可行,不知道在你的任务中是否可用

0
回复
FutureSI
#8 回复于2021-07
貌似这种情况,需要把VGG放到GAN模型里面去。 也就是说不可以有多个模型。

谢谢,嫁接动静也不小啊,这是模型杂交技术~~

其实gan就是杂交出来的,有时还把人家编解码器拆成两半用

0
回复
FutureSI
#9 回复于2021-07
trainer #7
我在使用paddledetection2.1时遇到过同样问题,技术人员给出的解决方法实在config中加入 find_unused_parameters: true 在pddet中可行,不知道在你的任务中是否可用
展开

嗯,报错里有这个建议,我试试

0
回复
FutureSI
#10 回复于2021-07
嗯,报错里有这个建议,我试试

find_unused_parameters: true这个设置时ppdet里的吧,我查文档这个是 DataParallel api 的参数

0
回复
FutureSI
#11 回复于2021-07
FutureSI #10
find_unused_parameters: true这个设置时ppdet里的吧,我查文档这个是 DataParallel api 的参数

是pddet哈哈,paddledetection

0
回复
UnseenMe
#12 回复于2021-07
谢谢,嫁接动静也不小啊,这是模型杂交技术~~ 其实gan就是杂交出来的,有时还把人家编解码器拆成两半用

抗旱抗病虫的高产模型就要诞生啦,哈哈哈

0
回复
FutureSI
#13 回复于2021-07
trainer #7
我在使用paddledetection2.1时遇到过同样问题,技术人员给出的解决方法实在config中加入 find_unused_parameters: true 在pddet中可行,不知道在你的任务中是否可用
展开

我试了下,在给api加上这个参数设置还是报错

vgg19 = paddle.DataParallel(vgg19, find_unused_parameters=True)

0
回复
FutureSI
#14 回复于2021-07
trainer #7
我在使用paddledetection2.1时遇到过同样问题,技术人员给出的解决方法实在config中加入 find_unused_parameters: true 在pddet中可行,不知道在你的任务中是否可用
展开

大佬说的这个

“find_unused_parameters: true”

是在yaml文件里设置得么?

 

0
回复
FutureSI
#15 回复于2021-07
UnseenMe #12
抗旱抗病虫的高产模型就要诞生啦,哈哈哈

模型杂交~~

0
回复
trainer
#16 回复于2021-07
FutureSI #14
大佬说的这个 “find_unused_parameters: true” 是在yaml文件里设置得么?  

是的

0
回复
FutureSI
#17 回复于2021-07
trainer #16
是的

谢谢,我去看看代码吧,可能改动不止数据并行那一处

0
回复
z
zzzzhelp995
#18 回复于2022-06
FutureSI #17
谢谢,我去看看代码吧,可能改动不止数据并行那一处

兄弟我也遇到这个错误了

有印象最终是怎么解决的了吗

0
回复
李长安
#19 回复于2022-07

学到了学到了,大佬厉害

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户