danijar / dreamerv2

Mastering Atari with Discrete World Models
https://danijar.com/dreamerv2
MIT License
898 stars 195 forks source link

AssertionError and AttributeError dreamerv2 in jupyter-notebook #22

Closed balloch closed 3 years ago

balloch commented 3 years ago

Hi! I am trying to run the minigrid and crafter examples in a Jupyter notebook, but i keep getting this error when running the config.

Command (minigrid):

config = dv2.defaults.update({
    'logdir': '~/logdir/crafter',
    'log_every': 1e3,
    'train_every': 10,
    'prefill': 1e5,
    'actor_ent': 3e-3,
    'loss_scales.kl': 1.0,
    'discount': 0.99,
}).parse_flags()

Assertion Error:

~/miniconda3/envs/hacking/lib/python3.8/site-packages/dreamerv2/common/flags.py in parse(self, argv, known_only, help_exists)
     45         if flag.startswith('--'):
     46           raise ValueError(f"Flag '{flag}' did not match any config keys.")
---> 47       assert not remaining, remaining
     48       return parsed
     49 

AssertionError: ['-f', '/home/balloch/.local/share/jupyter/runtime/kernel-244efe8b-5d51-499b-bfa2-7611c02c8e5b.json']

Command (crafter)

config = dv2.defaults.update().parse_flags()

Attribute Error:

AttributeError: 'dict' object has no attribute 'crafter'
danijar commented 3 years ago

Hey, try removing the .parse_flags() because you probably don't want to parse command line flags when you run in colab.