FinRL
FinRL copied to clipboard
How to SAVE a trained model with SB3?
Hi AI4Finance,
When going through the code in the tutorials, I found that ElegantRL trained models and saved simultaneously, but SB3 did not. I want to reuse the models trained by SB3 without re-training, which is too time consuming.
Thanx.
# Instantiate the agent model = DQN("MlpPolicy", env, verbose=1) # Train the agent and display a progress bar model.learn(total_timesteps=int(2e5), progress_bar=True) # Save the agent model.save("dqn_lunar") del model # delete trained model to demonstrate loading
This takes 5 seconds to search. Basic Usage: Training, Saving, Loading