p-christ / Deep-Reinforcement-Learning-Algorithms-with-PyTorch

PyTorch implementations of deep reinforcement learning algorithms and environments
MIT License
5.66k stars 1.2k forks source link

Implement model saves #47

Open LucCADORET opened 4 years ago

LucCADORET commented 4 years ago

Hi. Great work on the library, it's working like a charm.

Right now, only the DQN Agent implements the locally_save_policy that allows for saving the current model. Would it be possible to add this feature on other agents also ?

handaoui-mohamed commented 4 years ago

I think you can implement that by simply saving all the networks of that specific class [not tested], example:

def locally_save_policy(self):
        """Saves the policy"""
        torch.save(self.nn_local.state_dict(), "Models/{}_local_network.pt".format(self.agent_name))
        torch.save(self.nn_target.state_dict(), "Models/{}_target_network.pt".format(self.agent_name))

I'll have to confirm this.

alfred100p commented 2 years ago

Has there been any updates related to this?