eleurent / rl-agents

Implementations of Reinforcement Learning and Planning algorithms
MIT License
553 stars 149 forks source link

'Adam' object has no attribute 'get_updates' #103

Closed AashiDutt closed 10 months ago

AashiDutt commented 10 months ago

When applying dqn.fit, I'm getting the following error:

### AttributeError: 'Adam' object has no attribute 'get_updates'

Here is my code for reference:

dqn=DQNAgent(model=model, memory=memory, policy=policy, enable_dueling_network=True, dueling_type='avg', nb_actions=actions,nb_steps_warmup=1000)

dqn.compile( optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001), metrics=['accuracy'] )

dqn.fit(env,nb_steps=5000,visualize=False, verbose=1)

eleurent commented 10 months ago

Hi, If you're using this library, that's not how DQN training was intended. Instead, you should should use the Evaluation class which takes an agent and env, and run evaluation.train()

See for example this colab

AashiDutt commented 10 months ago

Thank You, I'll give it a try.