maddpg 复现过程中遇到的问题

在复现论文中基于PyTorch的Multi-AgentActor-Critic算法时,遇到了数据类型不匹配和梯度计算异常的错误。通过将PyTorch版本降至1.4.0成功解决问题,无需修改代码。此外,文中还提及了PettingZoo环境的一小时实践入门。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在复现论文Multi-Agent Actor-Critic for Mixed
Cooperative-Competitive Environments
跑代码遇到一些错误。

RuntimeError: Found dtype Double but expected Float

将代码中的类型替换后,又出现错误
RuntimeError: Found dtype Float but expected Double 

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [256]] is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

最后将pytorch降级搞定了,不用改啥代码。

降级先删除现有的。再安装降级后的。

pip list

pip uninstall torch

pip install torch==1.4.0

pettingzoo

一小时实践入门 PettingZoo - 知乎


 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值