Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obstacle Tower in headless-mode #2

Open
jkuypers93 opened this issue Mar 27, 2021 · 2 comments
Open

Obstacle Tower in headless-mode #2

jkuypers93 opened this issue Mar 27, 2021 · 2 comments

Comments

@jkuypers93
Copy link

Hi, thank you for sharing your work!

I am trying to run your code for Obstacle Tower on a cluster but I keep getting timeout errors from ml-agents

File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/mlagents/envs/rpc_communicator.py", line 86, in initialize
    "The Unity environment took too long to respond. Make sure that :\n"
mlagents.envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that :
	 The environment does not need user interaction to launch
	 The Academy's Broadcast Hub is configured correctly
	 The Agents are linked to the appropriate Brains

I think it is due to the fact that I am running it in headless mode. Did you run into a similar issue? Any idea on how to run it in headless mode using xvfb?

Thanks in advance!

@Miffyli
Copy link
Owner

Miffyli commented Mar 28, 2021

Hey! Happy to hear people are finding the code useful :)

I see OT environment has had some updates since this project. I tried installing the newest version (this functionality should be same with code here) and running it with xvfb-run -a ..., and things seem to work (first line is to disable display):

anssk@anssk-workhorse:~/temp$ export DISPLAY=""
anssk@anssk-workhorse:~/temp$ xvfb-run -a ipython3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from obstacle_tower_env import ObstacleTowerEnv

In [2]: env = ObstacleTowerEnv()
Found path: /tmp/ml-agents-binaries/binaries/ObstacleTower-3ab155c962d77775bc1e66b866180213/ObstacleTower/obstacletower.x86_64
INFO:mlagents_envs.environment:Connected to Unity environment with package version 1.2.0-preview and communication version 1.0.0
INFO:mlagents_envs.environment:Connected new brain:
ObstacleTowerAgent-v4.1?team=0
INFO:gym_unity:1 agents within environment.

In [3]:

Without xvfb-run I am getting the same error as you are upon creating the environment.

Can you try if this works? You can add xvfb-run -a .... before running the .sh script for obstacle tower experiments.

System:

  • Ubuntu 20.04 LTS
  • Python 3.8 (system's default)

@jkuypers93
Copy link
Author

Thanks for getting back to me.

That worked for me. However, my worker nodes did not seem to have access to a virtual screen, so I had to create a display in my Worker class

from pyvirtualdisplay import Display

@ray.remote
class Worker:
    def __init__(self, config, env_creator, worker_index):
        self.display = Display(visible=0, size=(800, 600), backend="xvfb")
        self.display.start()
        ...

Thanks again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants