-
Notifications
You must be signed in to change notification settings - Fork 454
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
[QUESTION] Stable Baseline render vectorized forex enviroment #1
Comments
Hi. I didn't test it, so please check it out and let me know if it works. |
Thank you @AminHP It worked, but there was another issue in
|
It seems the problem is solved. Try to remove your
|
Can you show me your code? |
env = DummyVecEnv([lambda: gym.make('forex-v0', frame_bound=(100, 5000), window_size=10)])
# Training Env
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=1000)
# Testing Env
observation = env.reset()
while True:
# action = env.action_space.sample()
action = model.predict(observation)
observation, reward, done, info = env.step(action)
# env.render()
if done:
print("info:", info)
break
# Plotting results
plt.cla()
env.envs[0].render_all()
plt.show() |
The problem is something inside the Also, there was a mistake in your code. Try this: env_maker = lambda: gym.make('forex-v0', frame_bound=(100, 5000), window_size=10)
env = DummyVecEnv([env_maker])
# Training Env
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=1000)
# Testing Env
env = env_maker()
observation = env.reset()
while True:
observation = observation[np.newaxis, ...]
# action = env.action_space.sample()
action, _states = 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() |
Thank you @AminHP I must have missed the reset of the environment in The code above works perfectly! |
Hello, I have a question...
I'm currently using the stable baselines library to train a model using your 'forex-v0' environment.
After training the model I perform a test using your code:
But unfortunately I get a
DummyVecEnv
has norender_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 callenv.render_all()
The text was updated successfully, but these errors were encountered: