alfworld / alfworld

ALFWorld: Aligning Text and Embodied Environments for Interactive Learning
MIT License
343 stars 53 forks source link

Error about "alfworld-play-tw" in the terminal #69

Open a-FCBer opened 3 months ago

a-FCBer commented 3 months ago

Hello, I successfully download the ALFWorld, but when I type "alfworld-play-tw" in the terminal, an error occured. Here is the output:

/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/torch/cuda/init.py:619: UserWarning: Can't initialize NVML warnings.warn("Can't initialize NVML") /XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/torch/cuda/init.py:749: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 9010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.) return torch._C._cuda_getDeviceCount() if nvml_count < 0 else nvml_count Playing '/XXXX/json_2.1.1/train/pick_and_place_with_movable_recep-AppleSliced-Bowl-Fridge-21/trial_T20190919_030237_944406'. Traceback (most recent call last): File "/XXXX/PythonVenv/ALFWorld/bin/alfworld-play-tw", line 92, in main(args) File "/XXXX/PythonVenv/ALFWorld/bin/alfworld-play-tw", line 51, in main obs, infos = env.reset() ^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/gym/envs/textworld.py", line 48, in reset obs, infos = super().reset() ^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/gym/envs/textworld_batch.py", line 118, in reset self.batch_env.load(gamefiles) File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/batch/batch_env.py", line 217, in load env.load(game_file) File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/core.py", line 336, in load return self._wrapped_env.load(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/alfworld/agents/environment/alfred_tw_env.py", line 93, in load super().load(gamefile) File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/core.py", line 336, in load return self._wrapped_env.load(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/alfworld/agents/environment/alfred_tw_env.py", line 31, in load super().load(*args, **kwargs) File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/core.py", line 336, in load return self._wrapped_env.load(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/core.py", line 336, in load return self._wrapped_env.load(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/wrappers/generic.py", line 22, in load self._wrap(textworld.start(gamefile, self.request_infos)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/helpers.py", line 52, in start env.load(path) File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/pddl/pddl.py", line 61, in load self._pddl_state = pddl_logic.PddlState(self.downward_lib, self._game_data["pddl_problem"], self._logic) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/pddl/logic/init.py", line 213, in init facts = [atom.get_fact(self.name2type) for atom in atoms] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/pddl/logic/init.py", line 213, in facts = [atom.get_fact(self.name2type) for atom in atoms] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/pddl/logic/init.py", line 135, in get_fact arguments = [Variable(self._get_var_name(arg), name2type[arg]) for arg in args if arg] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/XXXX/PythonVenv/ALFWorld/lib/python3.11/site-packages/textworld/envs/pddl/logic/init.py", line 135, in arguments = [Variable(self._get_var_name(arg), name2type[arg]) for arg in args if arg]


KeyError: 'val1'

What confused me is that this error does not always occur if I type "alfworld-play-tw" in the terminal, sometimes (maybe 1 in 5) this game can run successfully. It seems that the error is about NVIDIA drive version and the Pytorch version, but my workstation does not have a GPU, how can I modify the configuration so that the game could run purely on CPU? I think since I have a small chance to run it successfully, it means my workstation has met the requirement to run "alfworld-play-tw", and maybe there is such a configuration to avoid this game to use GPU?
MarcCote commented 3 months ago

The KeyError: 'val1' error has nothing to do with Nvidia. Some games from the ALFRED dataset are not supported by ALFworld. By default, alfworld-play-tw randomly pick a game from the whole ALFRED dataset (see note on https://github.com/alfworld/alfworld/tree/master/scripts#play).

I believe this PR https://github.com/alfworld/alfworld/pull/61 would avoid sampling those games in the first place. I still need to review it and merge though.

a-FCBer commented 3 months ago

The KeyError: 'val1' error has nothing to do with Nvidia. Some games from the ALFRED dataset are not supported by ALFworld. By default, alfworld-play-tw randomly pick a game from the whole ALFRED dataset (see note on https://github.com/alfworld/alfworld/tree/master/scripts#play).

I believe this PR #61 would avoid sampling those games in the first place. I still need to review it and merge though.

Got it! Thanks to your reply!

xiaxiaxiatengxi commented 3 months ago

alfworld-play-thor I get the error:

xdpyinfo: unable to open display ":0". subprocess.call("xdpyinfo", stdout=dn, env=env, shell=True) == 0 AssertionError: Invalid DISPLAY :0 - cannot find X server with xdpyinfo

MarcCote commented 3 months ago

Are you running ALFWorld on a remote machine by any chance?

xiaxiaxiatengxi commented 3 months ago

Are you running ALFWorld on a remote machine by any chance?

right!! My environment is a cluster environment where we are unable to install an X server. I planned to simulate the X server using xvfb-run during startup. However, in ai2thor/controller.py at line 1182 self.last_event = self.server.receive(), I am unable to receive any messages and it gets stuck at this point.

Is it not possible to execute commands on the cluster?

My versions are: ai2thor==3.1.0 alfworld==0.3.4

The command I executed is as follows: xvfb-run -s "-screen 0 300x300x24" accelerate launch --config_file config_zero2.yaml --main_process_port 29330 ../main_alf.py The main_alf.py code is as follows:

import other packages from alfworld.agents.environment.alfred_thor_env import AlfredThorEnv env = AlfredThorEnv(config, train_eval='train') env.init_env(batch_size=1)

MarcCote commented 2 months ago

This seems to be an issue with your cluster. It is hard for me to troubleshoot. That said, the ai2thor version should be ai2thor==2.1.0 and do make sure you have werkzeug==2.0.3 installed.