SofaDefrost / SofaGym

Machine Learning framework for Sofa
72 stars 11 forks source link

AttributeError: 'numpy.random._generator.Generator' object has no attribute 'seed' #49

Closed Emanuele-n closed 1 year ago

Emanuele-n commented 1 year ago

Hello,

python test_env.py -e trunk-v0 -ep 100 -s 100

works fine but when I try:

python rl.py -e trunk-v0 -a PPO

I get the following error:

Traceback (most recent call last): File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/rl.py", line 112, in agent = Agent(env_name, algo_name, seed, results_dir, max_episode_steps, n_envs) File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/agents/SB3Agent.py", line 18, in init super().init(env_id, seed, output_dir, max_episode_steps, n_envs) File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/agents/SofaBaseAgent.py", line 79, in init super().init(env_id, seed, output_dir, max_episode_steps) File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/agents/SofaTestAgent.py", line 82, in init self.test_env = self.env_make() File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/agents/SofaTestAgent.py", line 154, in env_make self.env_seed(env) File "/home/emanuele/Desktop/github/sim/sofa/SofaGym/agents/SofaTestAgent.py", line 170, in env_seed env.action_space.np_random.seed(self.seed)

OS: Ubuntu 22.04.3 LTS Sofa: v22.12 SofaGym: just cloned from main branch, and followed the installation instructions

Can you help me please?

samuelmyoussef commented 1 year ago

Hello @Emanuele-n,

Can you check the gym and numpy versions you're working with? Try gym 0.21 and numpy 1.23.5

Emanuele-n commented 1 year ago

It worked, I was using a newer version of numpy. Thanks a lot