0

In the DQN algorithm, the agent is trained successfully and the model is saved as a .h5 file. The agent class has a method called load as follows:

def load(self):
    new_model = load_model('dqn_model.h5')
    if self.epsilon == 0.0:
       self.update_network_parameters()
    return new_model

def update_network_parameters(self):
    self.model.set_weights(self.new_model.get_weights())

I try to run the evaluation step by creating the new_model as follows:

new_model = agent.load()

but the new_model doesn't have any method like predict.

1 Answers1

0

Ensure you have Model imported within the class your calling agent.load from.

from keras.models import Model

Also, for me personally, model.predict doesn't show up within Intellisense so make sure that code actually doesn't compile when you run it. If so tell us what the exception error is.

M5RKED
  • 73
  • 1
  • 16