zzmtsvv / sac_rnd

4 stars 0 forks source link

Can not find "json_datasets" folder and json files like "walker2d-medium-v2.json" #2

Closed zh4men9 closed 7 months ago

zh4men9 commented 7 months ago

Hi,

I cannot find the "json_datasets" folder and json files like "walker2d-medium-v2.json", can you tell me how to get them, please!

Thanks!

zzmtsvv commented 7 months ago

Hi,

If you would like to reproduce my results of training, then you should get json files for appropriate datasets in another environment where you have access to mujoco and convert d4rl datasets to json files (As I did, I've downloaded a notebook as an example, it worked in colab when I was implementing the paper) -

However, if you have no problems with mujoco on your machine you shouldn't jsonify anything but just rewrite __init__ method of the Trainer:

class SACRNDTrainer:
    def __init__(self,
                 cfg=rnd_config) -> None:
        make_dir("weights")

        self.device = cfg.device
        self.batch_size = cfg.batch_size
        self.cfg = cfg

        self.eval_env = gym.make(cfg.dataset_name)
        self.eval_env.seed(cfg.eval_seed)
        d4rl_dataset = d4rl.qlearning_dataset(self.eval_env)

        self.state_dim = self.eval_env.observation_space.shape[0]
        self.action_dim = self.eval_env.action_space.shape[0]

        self.buffer = ReplayBuffer(self.state_dim, self.action_dim)
        self.buffer.from_d4rl(d4rl_dataset)
        # self.buffer.from_json(cfg.dataset_name)

        seed_everything(cfg.train_seed)

And, if you wish, uncomment parts of code associated with evaluation (I commented it because I couldn't do eval on my machine)

zzmtsvv commented 7 months ago

And if you do so and find any bugs I will be pleased if you notify me about this :)

zh4men9 commented 7 months ago

Thank you. This solved my problem.