我是新手,用了官方的强化学习的例子,出错了
收藏
快速回复
AI Studio平台使用 问答其他 1566 8
我是新手,用了官方的强化学习的例子,出错了
收藏
快速回复
AI Studio平台使用 问答其他 1566 8

我是新手,用了官方的强化学习的例子,出错了,应该怎么办?

 

TypeError Traceback (most recent call last) in
95 model = CartpoleModel(act_dim=2)
96 alg = parl.algorithms.PolicyGradient(model, lr=1e-3)
---> 97 agent = CartpoleAgent(alg, obs_dim=OBS_DIM, act_dim=2)
98 for i in range(1000):
99 obs_list, action_list, reward_list = run_episode(env, agent)
in __init__(self, algorithm, obs_dim, act_dim)
19 self.obs_dim = obs_dim
20 self.act_dim = act_dim
---> 21 super(CartpoleAgent, self).__init__(algorithm)
22
23 def build_program(self):
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/parl/core/fluid/agent.py in __init__(self, algorithm, gpu_id)
85 self.gpu_id = 0 if machine_info.is_gpu_available() else -1
86
---> 87 self.build_program()
88
89 self.place = fluid.CUDAPlace(
in build_program(self)
28 obs = layers.data(
29 name='obs', shape=[self.obs_dim], dtype='float32')
---> 30 self.act_prob = self.alg.predict(obs)
31
32 with fluid.program_guard(self.train_program):
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/parl/algorithms/fluid/policy_gradient.py in predict(self, obs)
55 """ use policy model self.model to predict the action probability
56 """
---> 57 return self.model(obs)
58
59 @deprecated(
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/parl/core/model_base.py in __call__(self, *args, **kwargs)
93 """Call forward function.
94 """
---> 95 return self.forward(*args, **kwargs)
in forward(self, obs)
11
12 def forward(self, obs):
---> 13 out = self.fc1(obs)
14 out = self.fc2(out)
15 return out
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/parl/core/fluid/layers/layer_wrappers.py in __call__(self, input, is_test)
154 bias_attr=self.attr_holder.bias_attr,
155 act=act,
--> 156 is_test=is_test)
157
158 return FC_()
TypeError: fc() got an unexpected keyword argument 'is_test'

0
收藏
回复
全部评论(8)
时间顺序
AIStudio810258
#2 回复于2020-02

跟着调用栈逐级查找。一般都是输入参数的数量或类型错误。

0
回复
AIStudio810258
#3 回复于2020-02

有时最深的那一层未必是出错的那一层。

0
回复
水水水的老师
#4 回复于2020-02

应该是数据参数的数量或类型错误

0
回复
CChan
#5 回复于2020-03

会不会是因为版本不对接口对不上

0
回复
水水水的老师
#6 回复于2020-03
CChan #5
会不会是因为版本不对接口对不上

我觉得也有可能

0
回复
AIStudio810258
#7 回复于2020-03

可以换下环境的paddle版本试试

0
回复
AIStudio810258
#8 回复于2020-03

这样就能快速知道是不是版本导致的问题。

0
回复
毡济堑柯
#9 回复于2020-11

换了版本也不行,直接用tensorflow改写了2333

0
回复
在@后输入用户全名并按空格结束,可艾特全站任一用户