警告内容
Warning: find_unused_parameters=True was specified in DDP constructor, but did not find any unused parameters in the forward pass. This flag results in an extra traversal of the autograd graph every iteration, which can adversely affect performance. If your model indeed never has any unused parameters in the forward pass, consider turning this flag off. Note that this warning may be a false positive if your model has flow control causing later iterations to have unused parameters. (function operator())
警告原因
这个警告来自于 PyTorch 中的分布式数据并行(DDP)设置,主要提醒用户在使用 DDP 构造函数时设置了 find_unused_parameters=True,但在前向传播过程中没有找到任何未使用的参数。
解决方法
warning不碍事,find_unused_parameters的默认值就是True,功能可以理解为检查网络前向传播过程中是否有未使用到的参数,最好不要修改!下面的解释可以不看!