-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug] Step environment that needs reset #224
Comments
Hello, The provided code is incomplete and seems wrong. obs = env.reset()
n_episodes = 3000
current_episode = 0
while current_episode < n_episodes:
action, _ = agent.predict(obs)
obs, reward, done, info = env.step(action)
# No need to reset, env is resetted automatically
if done[0]:
current_episode += 1 We also provide a |
If I want to limit each episode to include 60 timesteps. Will this be a problem? env = make_atari_env('PongNoFrameskip-v4', n_envs=1, seed=args.seed)
env = VecFrameStack(env, n_stack=4)
agent = DQN.load(model_path)
episode_count = 3000
for i in range(episode_count):
state = env.reset()
steps = 0
while True:
action, state = model.predict(obs, state=state, deterministic=deterministic)
obs, _, done, infos = env.step(action)
# add action and obs to buffer
steps += 1
if steps == 60:
break |
What will be a problem? Please take a closer look at the code I provided ;) (it is a bit hard to follow the logic if your snippet)
|
Thank you very much, I've got it now. |
If the issue is fixed, then you can close this one ;) |
Would you please tell me how to fix the problem? thanks |
@longfeizhang617 You better open up a new issue (we do not know what is wrong in your case). However, go through documentation and examples carefully before opening the issue. Note that we do not offer tech support for custom environments. |
🐛 Step environment that needs reset
I train DQN on Pong, and I want to use this trained agent to collect 3000 episodes. Each episode contains 60 timesteps. Every time I start a new episode, I use
env.reset()
. My code is like this.When I ran the program for a period of time and collected around 1000 episodes, the program suddenly reported an error like this. It's really confusing, it looks like the env cannot be reset.
The text was updated successfully, but these errors were encountered: