Makis Kans
Makis Kans

Reputation: 337

Vector Env with custom model

I've been reading about how to use vectorized environments with the SubProcVenv module from here and here.

However all the examples I can find use the stable baselines (openai's models) and I can't seem to find a way to do it with my custom model.

Can it be done? And how so?

Upvotes: 1

Views: 1727

Answers (1)

Senthamizhan
Senthamizhan

Reputation: 19

It can be done as mentioned in the Colab notebook. I'm not sure what problem you are facing. The way I implemented for my custom environment is:

# Instantiate the env
env = customEnv()

# Wrap it
env = DummyVecEnv([lambda: env])

EPISODES = 5000
# Instantiate and learn using stable-baselines
model = PPO2('MlpPolicy', env).learn(EPISODES)

I'm sure you can do the same for SubProcVenv too. Go for SubProcVenv only if you want to use multiprocessing.

Upvotes: 1

Related Questions