princeton-nlp / lwm

We develop world models that can be adapted with natural language. Intergrating these models into artificial agents allows humans to effectively control these agents through verbal communication.
https://language-guided-world-model.github.io
GNU General Public License v3.0
19 stars 3 forks source link

Something wrong with the gym render #1

Open Lr-2002 opened 7 months ago

Lr-2002 commented 7 months ago

Hello, Thanks for your great work, It has did a lot in language work, While ,When i'm trying to run the play_wm.py, It throw the error of gym.render() need 1 positional args, while 2 were given. Then i delete the render func 'args to only self Re-run play, It throw the error of "Not Implementderror"

Lr-2002 commented 7 months ago
Traceback (most recent call last):
  File "/home/lr-2002/code/lwm/world_model/play_wm.py", line 54, in <module>
    env.render()
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render(mode, **kwargs)
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render(mode, **kwargs)
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render(mode, **kwargs)
  [Previous line repeated 1 more time]
TypeError: render() takes 1 positional argument but 2 were given
Lr-2002 commented 7 months ago

original

    def render(self, mode="human", **kwargs):
        return self.env.render(mode, **kwargs)

after delete the render's args to this :

    def render(self):
        return self.env.render()
Traceback (most recent call last):
  File "/home/lr-2002/code/lwm/world_model/play_wm.py", line 54, in <module>
    env.render()
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render()
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render()
  File "/home/lr-2002/anaconda3/envs/lwm/lib/python3.9/site-packages/gym/core.py", line 286, in render
    return self.env.render()
  [Previous line repeated 1 more time]
  File "/home/lr-2002/code/lwm/messenger/envs/base.py", line 44, in render
    raise NotImplementedError
NotImplementedError
alexzhang13 commented 7 months ago

Hi, what version of gym are you using? There are often versioning issues with env.render() and env.step() arguments.

Lr-2002 commented 7 months ago

gym == 0.22.0 pygame == 2.5.1

alexzhang13 commented 6 months ago

Hi sorry I didn't get to this, @Lr-2002 is this still an issue that you're having? It's most likely a simple change with regards to the gym environment and the extra parameters that env.render() might expect.