mushroom-rl-benchmark
mushroom-rl-benchmark copied to clipboard
TypeError: Gym.__init__() missing 1 required positional argument: 'name'
I have this error
Traceback (most recent call last):
File "/home/davide/code/ML/RL/bench.py", line 37, in <module>
exp.run(
File "/home/davide/code/mushroom-rl-benchmark/mushroom_rl_benchmark/core/experiment.py", line 63, in run
run_fn(**executor_params, **run_params)
File "/home/davide/code/mushroom-rl-benchmark/mushroom_rl_benchmark/core/experiment.py", line 157, in run_parallel
runs = parallel(
File "/home/davide/code/mushroom-rl-benchmark/mushroom_rl_benchmark/utils/tqdm_parallel.py", line 9, in __call__
return joblib.Parallel.__call__(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/joblib/parallel.py", line 1098, in __call__
self.retrieve()
File "/usr/local/lib/python3.10/dist-packages/joblib/parallel.py", line 975, in retrieve
self._output.extend(job.get(timeout=self.timeout))
File "/usr/local/lib/python3.10/dist-packages/joblib/_parallel_backends.py", line 567, in wrap_future_result
return future.result(timeout=timeout)
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
TypeError: Gym.__init__() missing 1 required positional argument: 'name'
With this code:
import time
from mushroom_rl_benchmark.core import BenchmarkExperiment, BenchmarkLogger
from mushroom_rl_benchmark.builders import EnvironmentBuilder, PPOBuilder
if __name__ == '__main__':
logger = BenchmarkLogger(
log_dir='./logs',
log_id='ppo_pendulum'
)
agent_builder = PPOBuilder.default(
actor_lr=3e-4,
critic_lr=3e-4,
n_features=32
)
env_name = 'Gym'
env_params = dict(
env_id='Pendulum-v0',
horizon=200,
gamma=.99
)
parallel = dict(
max_concurrent_runs=10
)
env_builder = EnvironmentBuilder(env_name, env_params)
logger.info('Environment is imported')
exp = BenchmarkExperiment(agent_builder, env_builder, logger)
logger.info('BenchmarkExperiment was built successfully')
start_time = time.time()
exp.run(
exec_type='parallel',
n_runs=10,
n_epochs=100,
n_steps=30000,
n_episodes_test=5,
parallel=parallel
)
end_time = time.time()
logger.info('Execution time: {} SEC'.format(end_time-start_time))
exp.save_plot()