Skip to content
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

TypeError: reset_wait() got an unexpected keyword argument 'seed' #28

Open
eanas10 opened this issue Aug 19, 2023 · 0 comments
Open

TypeError: reset_wait() got an unexpected keyword argument 'seed' #28

eanas10 opened this issue Aug 19, 2023 · 0 comments

Comments

@eanas10
Copy link

eanas10 commented Aug 19, 2023

Hi,

When I call the env.reset or reset_wait() from the vector_env.py I recieve the following error:

TypeError Traceback (most recent call last)
Cell In[2], line 113
110 best_test_reward = reward
111 torch.save(net.state_dict(), os.path.join(saves_path, "best_%.3f.dat" % reward))
--> 113 engine.run(common.batch_generator(buffer, PARAMS.replay_initial,
114 PARAMS.batch_size))

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:892, in Engine.run(self, data, max_epochs, epoch_length, seed)
889 self.state.dataloader = data
891 if self.interrupt_resume_enabled:
--> 892 return self._internal_run()
893 else:
894 return self._internal_run_legacy()

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:935, in Engine._internal_run(self)
933 self._internal_run_generator = self._internal_run_as_gen()
934 try:
--> 935 return next(self._internal_run_generator)
936 except StopIteration as out:
937 self._internal_run_generator = None

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:993, in Engine._internal_run_as_gen(self)
991 self._dataloader_iter = None
992 self.logger.error(f"Engine run is terminating due to exception: {e}")
--> 993 self._handle_exception(e)
995 self._dataloader_iter = None
996 return self.state

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:638, in Engine._handle_exception(self, e)
636 self._fire_event(Events.EXCEPTION_RAISED, e)
637 else:
--> 638 raise e

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:959, in Engine._internal_run_as_gen(self)
956 if self._dataloader_iter is None:
957 self._setup_engine()
--> 959 epoch_time_taken += yield from self._run_once_on_dataset_as_gen()
961 # time is available for handlers but must be updated after fire
962 self.state.times[Events.EPOCH_COMPLETED.name] = epoch_time_taken

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:1087, in Engine._run_once_on_dataset_as_gen(self)
1085 except Exception as e:
1086 self.logger.error(f"Current run is terminating due to exception: {e}")
-> 1087 self._handle_exception(e)
1089 return time.time() - start_time

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:638, in Engine._handle_exception(self, e)
636 self._fire_event(Events.EXCEPTION_RAISED, e)
637 else:
--> 638 raise e

File ~/anaconda3/envs/MA/lib/python3.8/site-packages/ignite/engine/engine.py:1032, in Engine._run_once_on_dataset_as_gen(self)
1029 self._fire_event(Events.GET_BATCH_STARTED)
1030 yield from self._maybe_terminate_or_interrupt()
-> 1032 self.state.batch = next(self._dataloader_iter)
1033 self._fire_event(Events.GET_BATCH_COMPLETED)
1034 yield from self._maybe_terminate_or_interrupt()

File ~/MAgent2/lib/common.py:33, in batch_generator(buffer, initial, batch_size)
31 def batch_generator(buffer: experience.ExperienceReplayBuffer,
32 initial: int, batch_size: int):
---> 33 buffer.populate(initial)
34 while True:
35 buffer.populate(1)

File ~/MAgent2/ptan/ptan/experience.py:368, in ExperienceReplayBuffer.populate(self, samples)
363 """
364 Populates samples into the buffer
365 :param samples: how many samples to populate
366 """
367 for _ in range(samples):
--> 368 entry = next(self.experience_source_iter)
369 self._add(entry)

File ~/MAgent2/ptan/ptan/experience.py:176, in ExperienceSourceFirstLast.iter(self)
175 def iter(self):
--> 176 for exp in super(ExperienceSourceFirstLast, self).iter():
177 if exp[-1].done and len(exp) <= self.steps:
178 last_state = None

File ~/MAgent2/ptan/ptan/experience.py:53, in ExperienceSource.iter(self)
51 env_lens = []
52 for env in self.pool:
---> 53 obs = env.reset()
54 # if the environment is vectorized, all it's output is lists of results.
55 # Details are here: https://github.com/openai/universe/blob/master/doc/env_semantics.rst
56 if self.vectorized:

File ~/.local/lib/python3.8/site-packages/gym/vector/vector_env.py:108, in VectorEnv.reset(self, seed, options)
106 self.reset_async(seed=seed, options=options)
107 #self.reset_async()
**--> 108 return self.reset_wait(seed=seed, options=options)

TypeError: reset_wait() got an unexpected keyword argument 'seed'**

The issue is the arguments of the functions, particulary the seed. Is their a suggestion for a fix for this issue please? gym version 0.26 is installed.

Best wishes,

Essa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant