Christopher Tan commited on
Commit
9fb59ae
·
1 Parent(s): 89abf81

fixing openvla GL bugs

Browse files
Dockerfile CHANGED
@@ -19,6 +19,7 @@ RUN conda install -n base -y \
19
  "huggingface-hub>=0.20.0,<0.26.0"
20
 
21
  # Install build tools needed for runtime RoboEval installation
 
22
  RUN apt-get update -qq && \
23
  apt-get install -y -qq \
24
  build-essential \
@@ -30,6 +31,9 @@ RUN apt-get update -qq && \
30
  wget \
31
  curl \
32
  git \
 
 
 
33
  && rm -rf /var/lib/apt/lists/*
34
 
35
  # Install Bazel (bazelisk) for runtime RoboEval builds
 
19
  "huggingface-hub>=0.20.0,<0.26.0"
20
 
21
  # Install build tools needed for runtime RoboEval installation
22
+ # Also install OSMesa for headless OpenGL rendering (required for mujoco)
23
  RUN apt-get update -qq && \
24
  apt-get install -y -qq \
25
  build-essential \
 
31
  wget \
32
  curl \
33
  git \
34
+ libosmesa6-dev \
35
+ libgl1-mesa-glx \
36
+ libglib2.0-0 \
37
  && rm -rf /var/lib/apt/lists/*
38
 
39
  # Install Bazel (bazelisk) for runtime RoboEval builds
__pycache__/app.cpython-313.pyc CHANGED
Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ
 
inference_openvla.py CHANGED
@@ -18,6 +18,17 @@ try:
18
  import numpy as np
19
  from pathlib import Path
20
  from typing import Dict, Any, List, Optional, Tuple
 
 
 
 
 
 
 
 
 
 
 
21
  except Exception as e:
22
  # If we can't even import basic modules, try to print error
23
  try:
@@ -30,11 +41,6 @@ except Exception as e:
30
  pass # If we can't even print, give up
31
  sys.exit(1)
32
 
33
- # Set headless mode
34
- os.environ.setdefault("MUJOCO_GL", "egl")
35
- os.environ.setdefault("PYOPENGL_PLATFORM", "egl")
36
- os.environ.setdefault("XDG_RUNTIME_DIR", "/tmp")
37
-
38
  # Verify critical dependencies are available
39
  # Redirect stdout during imports to prevent libraries from printing to stdout
40
  import io
@@ -117,6 +123,18 @@ try:
117
  except ImportError as e:
118
  print(f"✗ RoboEval core modules import failed: {e}", file=sys.stderr, flush=True)
119
  sys.exit(1)
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  # Import all environment classes
122
  try:
 
18
  import numpy as np
19
  from pathlib import Path
20
  from typing import Dict, Any, List, Optional, Tuple
21
+
22
+ # Set headless mode BEFORE importing any graphics libraries
23
+ # These must be set before mujoco or any OpenGL libraries are imported
24
+ # Try OSMesa first (more reliable in Docker), fallback to egl
25
+ os.environ.setdefault("MUJOCO_GL", "osmesa") # OSMesa is more reliable than EGL in Docker
26
+ os.environ.setdefault("PYOPENGL_PLATFORM", "osmesa")
27
+ os.environ.setdefault("XDG_RUNTIME_DIR", "/tmp")
28
+ # Additional headless rendering environment variables
29
+ os.environ.setdefault("DISPLAY", ":99")
30
+ os.environ.setdefault("LIBGL_ALWAYS_SOFTWARE", "1")
31
+ os.environ.setdefault("GALLIUM_DRIVER", "llvmpipe")
32
  except Exception as e:
33
  # If we can't even import basic modules, try to print error
34
  try:
 
41
  pass # If we can't even print, give up
42
  sys.exit(1)
43
 
 
 
 
 
 
44
  # Verify critical dependencies are available
45
  # Redirect stdout during imports to prevent libraries from printing to stdout
46
  import io
 
123
  except ImportError as e:
124
  print(f"✗ RoboEval core modules import failed: {e}", file=sys.stderr, flush=True)
125
  sys.exit(1)
126
+ except Exception as e:
127
+ # Catch EGL/OpenGL errors during import
128
+ import traceback
129
+ error_msg = str(e)
130
+ if "egl" in error_msg.lower() or "opengl" in error_msg.lower() or "NoneType" in error_msg:
131
+ print(f"✗ RoboEval core modules import failed (graphics/EGL error): {e}", file=sys.stderr, flush=True)
132
+ print(f" This may be due to EGL/OpenGL initialization issues in headless mode.", file=sys.stderr, flush=True)
133
+ print(f" Traceback: {traceback.format_exc()}", file=sys.stderr, flush=True)
134
+ else:
135
+ print(f"✗ RoboEval core modules import failed: {e}", file=sys.stderr, flush=True)
136
+ print(f" Traceback: {traceback.format_exc()}", file=sys.stderr, flush=True)
137
+ sys.exit(1)
138
 
139
  # Import all environment classes
140
  try: