liuzuxin / DSRL

🔥 Datasets and env wrappers for offline safe reinforcement learning
https://offline-saferl.org
Apache License 2.0
65 stars 4 forks source link

AttributeError: 'SafetyWalker2dVelocityEnv' object has no attribute 'get_dataset' #3

Closed Yang6852 closed 5 months ago

Yang6852 commented 5 months ago

I replaced environment 'OfflineCarCircle-v0' with environment 'SafetyWalker2dVelocity-v1' in dsrl/test.py, import gymnasium as gym import dsrl # set seed seed = 0 # Create the environment env = gym.make('SafetyWalker2dVelocity-v1') # dsrl abides by the OpenAI gym interface # obs, info = env.reset(seed=seed) # obs, reward, terminal, timeout, info = env.step(env.action_space.sample()) # cost = info["cost"] # Each task is associated with a dataset # dataset contains observations, next_observatiosn, actions, rewards, costs, terminals, timeouts dataset = env.get_dataset() print(dataset['observations']) # An N x obs_dim Numpy array of observations and the code error is as follows: be065c86988574973025f6f2a7a5b57a

liuzuxin commented 5 months ago

Hi @XiaohanYang2333 , can you try to add Offline before the environment name? Like: OfflineSafetyWalker2dVelocity-v1?

Yang6852 commented 5 months ago

I changed it as what you said,and it worked.Thanks a lot.