Skip to content

resume the training  #1192

@rambo1111

Description

@rambo1111

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions