facebookresearch / mbrl-lib

Library for Model Based RL
MIT License
952 stars 154 forks source link

PETS Example Notebook Can't create Dynamics Model #149

Closed jpain3 closed 2 years ago

jpain3 commented 2 years ago

The example notebook pets_example.ipynb fails at the line: dynamics_model = common_util.create_one_dim_tr_model(cfg, obs_shape, act_shape) in code cell number 8 in the notebook.

The error thrown appears to be coming from the dictconfig.py routine within the omegaconf routine within the Hydra configuration handler.

ConfigAttributeError: Missing key model full_key: dynamics_model.model object_type=dict

From what I can tell, the dictconfig.py is expecting the object defined as cfg_dict, which is defined in code cell number 7 in the notebook, to have a a subkey called model within the main key dynamics_model.

I'm unsure how to force this subkey to be optional, or how to add an appropriate dict type subkey within the cfg_dict object to avoid the error, but as written this example notebook isn't running past this point. I've tried this with hydra-core-1.0.3, with the current version of mbrl has a dependency, and also the most up-to-date version of Hydra, hydra-core-1.1.1, with the same result.

As this is the 'Basic Example' that is used to introduce the MBRL package, I think it's important to get it working.

luisenp commented 2 years ago

Hi @jpain3, thanks for reporting! I think this was just me forgetting to update the notebook after one of our API updates, sorry about this. I'll fix it soon. I agree that this is an important example, so appreciate you taking the time to report.

luisenp commented 2 years ago

@jpain3 Are you running a specific version of the library? I tried git clone and then running the notebook without any pre-installed version of mbrl and it works for me.

jpain3 commented 2 years ago

Fixed now thanks! Installing MBRL directly from a clone of the repository works fine! All I'm getting now is a warning on that line that UserWarning: OmegaConf.is_none() is deprecated but the code is executing and proceeding now. Thanks!

Trying to replicate the original issue, the problem appears to be from me using a naïve pip install. When I create a new Python 3 kernel and run pip install mbrl with no additional version flags, then I again get the error listed above when trying to run the notebook. However, installing via pip install -e /path/to/githubclone/mbrl/ works ok (maybe it would also work if I explicitly specified the version with pip install mbrl==v0.1.5)

luisenp commented 2 years ago

Ah, I see. The issue is that the notebook is written according to the latest version of the repo, which is currently not the latest stable version in pip (v0.1.5). You didn't do anything wrong before, this is mostly a quirk of the current version status of the library (repo version is v0.2.4.dev). I added a note to the notebook explaining this, and a new notebook that is compatible with the pip version. Hope that helps!