from rl.agents.dqn import DQNAgent # create a DQNAgent agent = DQNAgent(model, nb_actions) # load saved weights agent.load_weights('weights.h5f')
from rl.agents.dqn import DQNAgent from keras.models import load_model # load a previously trained model model = load_model('my_model.h5') # create a DQNAgent with the loaded model agent = DQNAgent(model, nb_actions) # load saved weights agent.load_weights('weights.h5f')This example loads a previously trained model from a file called "my_model.h5", creates a DQNAgent with this model, and then loads saved weights from a file called "weights.h5f". The package library for the rl.agents.dqn module is Keras-RL.