facebookresearch / denoised_mdp

Open source code for paper "Denoised MDPs: Learning World Models Better Than the World Itself"
Other
134 stars 11 forks source link

Fix EnvInteractData with Python3.9 #6

Closed sebimarkgraf closed 2 years ago

sebimarkgraf commented 2 years ago

This fixes https://github.com/facebookresearch/denoised_mdp/issues/4 by changing the namedtuple to a dataclass.

ssnl commented 2 years ago

Thanks for the proposed fix! Can you change it so that it uses namedtuple still before 3.9? I tried to namedtuple for every case where things are getting created & destroyed in each iteration, and ideally would benefit from the lighter wrapper (of namedtuple compared to dataclass).

sebimarkgraf commented 2 years ago

I've changed it to use the NamedTuple from typing extensions. In 3.11 this will be officially supported: https://github.com/python/cpython/pull/92027

I am not sure about the performance benefits, this strongly depends on the use case and would probably need profiling here.

ssnl commented 2 years ago

Thanks!