AI4Finance-Foundation / ElegantRL

Massively Parallel Deep Reinforcement Learning. 🔥
https://ai4finance.org
Other
3.57k stars 823 forks source link

DQN #349

Open guest-oo opened 3 months ago

guest-oo commented 3 months ago

请问 我使用helloworld——DQN文件训练完成后 如何保存训练完成的神经网络参数以及在测试中对其进行使用。以及我应该如何设置自己想要的环境而不是gym现成的环境。

stellawang196 commented 1 month ago

In HelloWorld, it will save model during training and evaluation by using torch.save(actor.state_dict(), save_path). You can load it by using model.load_state_dict(torch.load(save_path)).

You may create your own environment class which can be inherited from gym.Env, and write your own step(), reset() and so on. Then you can use your env class and env_args to train the model.