brax icon indicating copy to clipboard operation
brax copied to clipboard

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

Open dmitryponv opened this issue 1 year ago • 0 comments

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) in <cell line: 24>() 22 plt.show() 23 ---> 24 train(progress_fn=progress) 25 26 print(f'time to jit: {times[1] - times[0]}')

5 frames 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 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 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 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 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 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

dmitryponv avatar Jul 17 '24 23:07 dmitryponv