[QUESTION] Stable Baseline render vectorized forex enviroment
See original GitHub issueHello, I have a question…
I’m currently using the stable baselines library to train a model using your ‘forex-v0’ environment.
env = DummyVecEnv([lambda: gym.make('forex-v0', frame_bound=(10, 500), window_size=10)])
policy_kwargs = dict(net_arch=[64, 'lstm',dict(vf=[128,128,128], pi=[64,64])])
model = A2C("MlpLstmPolicy", env, verbose=1, policy_kwargs=policy_kwargs)
model.learn(total_timesteps=5000)
After training the model I perform a test using your code:
observation = env.reset()
while True:
action = model.predict(observation)
observation, reward, done, info = env.step(action)
# env.render()
if done:
print("info:", info)
break
# Plotting results
plt.cla()
env.render_all()
plt.show()
But unfortunately I get a DummyVecEnv
has no render_all()
which makes sense to me because now the environment is in a Vector.
The thing I don’t understand is how I can call env.render_all()
in the Vector.
My confusion it’s because when I call env.render()
everything works fine, but not when I call env.render_all()
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Vectorized Environments - Stable Baselines - Read the Docs
Vectorized Environments are a method for stacking multiple independent environments into a single environment. Instead of training an RL agent on 1 ...
Read more >Newest 'stable-baselines' Questions - Stack Overflow
I would like to train a gym model based on a custom environment. The training loop looks like this: obs = env.reset() for...
Read more >Create custom gym environments from scratch — A stock ...
OpenAI's gym is an awesome package that allows you to create custom reinforcement learning agents. It comes with quite a few pre-built ...
Read more >Stable Baselines Documentation - Read the Docs
env.render(). 1.6.3 Multiprocessing: Unleashing the Power of Vectorized Environments. 14. Chapter 1. Main differences with OpenAI Baselines ...
Read more >QuickLaTeX - Pavel Holoborodko
and environments: equation , align , displaymath , eqnarray , multline , flalign ... Rendering into vector image format SVG, which means formulas...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is something inside the
DummyVecEnv
which resets the environment automatically after it is done.Also, there was a mistake in your code. Try this:
Thank you @AminHP
I must have missed the reset of the environment in
DummyVecEnv
. Now it makes much more sense.The code above works perfectly!