PaddlePaddle / PARL

A high-performance distributed training framework for Reinforcement Learning
https://parl.readthedocs.io/
Apache License 2.0
3.22k stars 817 forks source link

torch版本mappo案例用pytoch的gpu版本跑没问题,用cpu版本出错 #1050

Closed zzh-sonny closed 1 year ago

zzh-sonny commented 1 year ago

你好,系统报错信息 raise TypeError("cannot assign '{}' as parameter '{}' " TypeError: cannot assign 'torch.FloatTensor' as parameter 'stddev' (torch.nn.Parameter or None expected) 这个是什么原因那。是必须要用CUDA?

TomorrowIsAnOtherDay commented 1 year ago

这个具体是什么代码呢?是跑我们的example过程中出现的问题吗?

zzh-sonny commented 1 year ago

这个具体是什么代码呢?是跑我们的example过程中出现的问题吗? 是的,/PARL/benchmark/torch/mappo/ 这个例程

TomorrowIsAnOtherDay commented 1 year ago

能贴下完整的错误信息吗?

zzh-sonny commented 1 year ago

Traceback (most recent call last): File "train.py", line 267, in <module> main() File "train.py", line 163, in main train_info = agents[agent_id].learn( File "/home/shuoxing/zzh/work/rlCode/SourceCode/PARL/benchmark/torch/mappo/simple_agent.py", line 72, in learn value_loss, policy_loss, dist_entropy = self.alg.learn( File "/home/shuoxing/miniconda3/envs/pytorchcpu/lib/python3.8/site-packages/parl/algorithms/torch/mappo.py", line 176, in learn value_loss = self.cal_value_loss(values, value_preds_batch, File "/home/shuoxing/miniconda3/envs/pytorchcpu/lib/python3.8/site-packages/parl/algorithms/torch/mappo.py", line 198, in cal_value_loss self.value_normalizer.update(return_batch) File "/home/shuoxing/miniconda3/envs/pytorchcpu/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/shuoxing/miniconda3/envs/pytorchcpu/lib/python3.8/site-packages/parl/algorithms/torch/mappo.py", line 285, in update self.stddev = (self.mean_sq - self.mean**2).sqrt().clamp(min=1e-4) File "/home/shuoxing/miniconda3/envs/pytorchcpu/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1290, in __setattr__ raise TypeError("cannot assign '{}' as parameter '{}' " TypeError: cannot assign 'torch.FloatTensor' as parameter 'stddev' (torch.nn.Parameter or None expected)

zzh-sonny commented 1 year ago

版本:python=3.8 ,pytorchcpu 1.13.1

TomorrowIsAnOtherDay commented 1 year ago

感谢你的反馈,系统版本是?

zzh-sonny commented 1 year ago

操作系统 Operating System: Ubuntu 18.04.6 LTS Kernel: Linux 5.4.0-131-generic Architecture: x86-64 parl版本 2.1.1

TomorrowIsAnOtherDay commented 1 year ago

好的,我们在这个环境上测试下。

TomorrowIsAnOtherDay commented 1 year ago

hello,我们已经在PR #1060 上修复这个问题,请下载最新代码再试下。