-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Delete prng.py #1196
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
Delete prng.py #1196
Conversation
Since it seems like this seeding function is rarely used.
|
while I am in principle in favor of this change (I'd rather have prng state in the env than a separate global one) looks like there are more strings attached (judging by the test failures). Also putting @gdb in the loop - is there a reason to have a gym-global prng (vs local to environment)? |
|
I think @joschu chose to do it this particular way; I'd originally had the prng always in the environment. I don't recall the exact reasoning. |
|
Unfortunately, I don't remember the reasoning, so I'll leave it up to you @pzhokhov |
|
okay then... @zuoxingdong, please fix the test failures, and we can merge. |
|
@pzhokhov Previous failures are fixed. Could you help to check what is the current failure ? gym/envs/algorithmic/tests/test_algorithmic.py ................. [ 4%]
gym/envs/box2d/test_lunar_lander.py .. [ 5%]
gym/envs/tests/test_determinism.py FERROR: InvocationError for command '/usr/local/gym/.tox/py3/bin/pytest' (exited with code 1)
___________________________________ summary ____________________________________
ERROR: py3: commands failed |
|
I think the problem is lack of mujoco license key in the build... Which means tests on all external PR's are failing at the moment. Will fix shortly. |
|
should be fixed now, please pull upstream master into your branch to update the PR |
|
@pzhokhov Now it seems okay |
|
@pzhokhov oops, the current error seems from the random seed |
|
What I do now is to create a numpy random state as a class member within Or provide a In specific either def __init__(self, shape=None, dtype=None, seed=0):
import numpy as np # takes about 300-400ms to import, so we load lazily
self.shape = None if shape is None else tuple(shape)
self.dtype = None if dtype is None else np.dtype(dtype)
self.np_random = np.random.RandomState(seed)or class Space(object):
...
def seed(self, seed=0):
self.np_random = np.random.RandomState(seed) |
|
I am not sure I understand a use case for the seed() method in the API, could you explain? |
gym/core.py
Outdated
| @@ -1,3 +1,5 @@ | |||
| import numpy as np | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to import numpy here? looks like Space.__init__ intentionally uses lazy load of numpy
|
@pzhokhov The motivation here is the user can set the environment and its space objects with different seeds. |
|
@pzhokhov Now it seems works fine. |
|
@pzhokhov Shall we merge this ? |
|
@pzhokhov Conflicts resolved |
* Delete prng.py Since it seems like this seeding function is rarely used. * Update __init__.py * Update kellycoinflip.py * Update core.py * Update box.py * Update discrete.py * Update multi_binary.py * Update multi_discrete.py * Update test_determinism.py * Update test_determinism.py * Update test_determinism.py * Update core.py * Update box.py * Update test_determinism.py * Update core.py * Update box.py * Update discrete.py * Update multi_binary.py * Update multi_discrete.py * Update dict_space.py * Update tuple_space.py * Update core.py * Create space.py * Update __init__.py * Update __init__.py * Update box.py * Update dict_space.py * Update discrete.py * Update dict_space.py * Update multi_binary.py * Update multi_discrete.py * Update tuple_space.py * Update discrete.py * Update box.py * Update dict_space.py * Update multi_binary.py * Update multi_discrete.py * Update tuple_space.py * Update multi_discrete.py * Update multi_binary.py * Update dict_space.py * Update box.py * Update test_determinism.py * Update kellycoinflip.py * Update space.py
Because it seems like this seeding function is rarely used.