Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resume the training #1192

Open
rambo1111 opened this issue Feb 3, 2024 · 0 comments
Open

resume the training #1192

rambo1111 opened this issue Feb 3, 2024 · 0 comments

Comments

@rambo1111
Copy link

rambo1111 commented Feb 3, 2024

If i trained a model on mario and saved it after 100000 total_timesteps

import gym_super_mario_bros
from nes_py.wrappers import JoypadSpace
from gym_super_mario_bros.actions import COMPLEX_MOVEMENT
from gym.wrappers import GrayScaleObservation
from stable_baselines3.common.vec_env import VecFrameStack, DummyVecEnv
from stable_baselines3 import PPO

env = gym_super_mario_bros.make('SuperMarioBros-v0')
env = JoypadSpace(env, COMPLEX_MOVEMENT)
env = GrayScaleObservation(env, keep_dim=True)
env = DummyVecEnv([lambda: env])
env = VecFrameStack(env, 4, channels_order='last')
state = env.reset()

model = PPO('CnnPolicy', env, verbose=1, learning_rate=0.00001, n_steps=512)
model.learn(total_timesteps=100000)
model.save("saved_model_1")

env.close()

In future if i load the model and resume it's training on the same environment like this

env = gym_super_mario_bros.make('SuperMarioBros-v0')
env = JoypadSpace(env, COMPLEX_MOVEMENT)
env = GrayScaleObservation(env, keep_dim=True)
env = DummyVecEnv([lambda: env])
env = VecFrameStack(env, 4, channels_order='last')
state = env.reset()

model = PPO.load('saved_model_1')
model.learn(total_timesteps=200)
model.save("saved_model_2")

will it work?
will the model will resume it's training for next 200 steps after it's training on 100000 steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant