ElegantRL icon indicating copy to clipboard operation
ElegantRL copied to clipboard

a typeError in build_env() function

Open hululu-lzb opened this issue 1 year ago • 3 comments

I inherited from gym.Env and created a new class, passing in the additional parameter env_config in the init method of this new class. But when I use train_agent(), the built_env() will report an error, check elegantRL source code, this is because my gym.make is gym.envs.registration. So by default no parameters are passed when creating an environment. Is there any solution? image1 image2

hululu-lzb avatar May 11 '24 14:05 hululu-lzb

My demo is copied from fllow: image

hululu-lzb avatar May 11 '24 14:05 hululu-lzb

I meet the same quesation,did you solve it?

sonderli avatar May 24 '24 06:05 sonderli

gym.make() is used to initialize an environment specified by a unique name (ID). This ID corresponds to predefined environment configurations registered in Gym. If the env to make is from the registration system, such as CartPole-v1, the module will be gym.envs.registration.

To use self-defined env class inherited from gym.Env, there is no need to use gym.make().

stellawang196 avatar May 31 '24 23:05 stellawang196