carla-simulator / reinforcement-learning

Reinforcement learning baseline agent trained with the Actor-critic (A3C) algorithm.
Other
238 stars 60 forks source link

TypeError: __init__() got unexpected keyword argument(s) 'bias' #11

Open ajboloor opened 5 years ago

ajboloor commented 5 years ago

Command:

python3 run_RL.py --city-name Town01 --corl-2017

Error:

Traceback (most recent call last):
  File "run_RL.py", line 77, in <module>
    model_file='agent/trained_model/9600000.h5', n_actions=9, frameskip=1)
  File "/home/user/projects/carla-0.8.2/PythonClient/reinforcement-learning/agent/runnable_model.py", line 26, in __init__
    self.setup_model(self.n_actions, self.n_meas, self.args)
  File "/home/user/projects/carla-0.8.2/PythonClient/reinforcement-learning/agent/runnable_model.py", line 64, in setup_model
    self.model = run_train_test.get_model(n_actions, n_meas, args)
  File "/home/user/projects/carla-0.8.2/PythonClient/reinforcement-learning/agent/asyncrl/run_train_test.py", line 101, in get_model
    n_input_channels=args.n_images_to_accum, nonlinearity_str=args.nonlinearity, weight_init_str=args.weight_init, bias_init=args.bias_init)
  File "/home/user/projects/carla-0.8.2/PythonClient/reinforcement-learning/agent/asyncrl/run_train_test.py", line 65, in __init__
    self.dqn_net = dqn_head.NatureDQNHead(n_input_channels=n_input_channels, nonlinearity_str=nonlinearity_str, bias=bias_init)
  File "/home/user/projects/carla-0.8.2/PythonClient/reinforcement-learning/agent/asyncrl/dqn_head.py", line 18, in __init__
    L.Convolution2D(n_input_channels, 32, 8, stride=4, bias=bias),
  File "/home/user/.local/lib/python3.5/site-packages/chainer/links/connection/convolution_2d.py", line 124, in __init__
    ('dilate', 1), ('groups', 1))
  File "/home/user/.local/lib/python3.5/site-packages/chainer/utils/argument.py", line 18, in parse_kwargs
    raise TypeError(message)
TypeError: __init__() got unexpected keyword argument(s) 'bias'

with chainer==4.3.1

Fix: Change all L.Convolution2D params in reinforcement-learning/agent/asyncrl/dqn_head.py:

L.Convolution2D(n_input_channels, 32, 8, stride=4, bias=bias),

to (base -> initial_bias)

L.Convolution2D(n_input_channels, 32, 8, stride=4, initial_bias=bias),

Reference: http://docs.chainer.org/en/stable/reference/generated/chainer.links.Convolution2D.html