google / google/brax

TypeError: RandomNumberGenerator._generator_ctor() takes from 0 to 1 positional arguments but 2 were given

Open
#506 0 comments 0 reactions 1 assignee Claimed by @erikfrey View on GitHub
Dominant language
Jupyter Notebook
Stars
3.2k
Forks
349
PR merge metrics
No merged PRs in 30d

Description

Currently throwing error in Training_torch collab notebook
on Line **train(progress_fn=progress)**

**"TypeError: RandomNumberGenerator._generator_ctor() takes from 0 to 1 positional arguments but 2 were given"**

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
22 plt.show()
23
---> 24 train(progress_fn=progress)
25
26 print(f'time to jit: {times[1] - times[0]}')

5 frames
[](https://localhost:8080/#) in train(env_name, num_envs, episode_length, device, num_timesteps, eval_frequency, unroll_length, batch_size, num_minibatches, num_update_epochs, reward_scaling, entropy_cost, discounting, learning_rate, progress_fn)
67 episode_length=episode_length,
68 backend='spring')
---> 69 env = gym_wrapper.VectorGymWrapper(env)
70 # automatically convert between jax ndarrays and torch tensors:
71 env = torch_wrapper.TorchWrapper(env, device=device)

[/usr/local/lib/python3.10/dist-packages/brax/envs/wrappers/gym.py](https://localhost:8080/#) in __init__(self, env, seed, backend)
114 obs = np.inf * np.ones(self._env.observation_size, dtype='float32')
115 obs_space = spaces.Box(-obs, obs, dtype='float32')
--> 116 self.observation_space = utils.batch_space(obs_space, self.num_envs)
117
118 action = jax.tree.map(np.array, self._env.sys.actuator.ctrl_range)

[/usr/lib/python3.10/functools.py](https://localhost:8080/#) in wrapper(*args, **kw)
887 '1 positional argument')
888
--> 889 return dispatch(args[0].__class__)(*args, **kw)
890
891 funcname = getattr(func, '__name__', 'singledispatch function')

[/usr/local/lib/python3.10/dist-packages/gym/vector/utils/spaces.py](https://localhost:8080/#) in _batch_space_box(space, n)
48 repeats = tuple([n] + [1] * space.low.ndim)
49 low, high = np.tile(space.low, repeats), np.tile(space.high, repeats)
---> 50 return Box(low=low, high=high, dtype=space.dtype, seed=deepcopy(space.np_random))
51
52

[/usr/lib/python3.10/copy.py](https://localhost:8080/#) in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
173
174 # If is its own copy, don't memoize.

[/usr/lib/python3.10/copy.py](https://localhost:8080/#) in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
263 if deep and args:
264 args = (deepcopy(arg, memo) for arg in args)
--> 265 y = func(*args)
266 if deep:
267 memo[id(x)] = y

TypeError: RandomNumberGenerator._generator_ctor() takes from 0 to 1 positional arguments but 2 were given

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.