Georg commited on
Commit ·
698216c
1
Parent(s): 9e25588
Prepare HF Space deployment
Browse files- Dockerfile +2 -4
- mujoco_server.py +13 -0
Dockerfile
CHANGED
|
@@ -27,10 +27,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 27 |
# Copy application code (including the static frontend directory)
|
| 28 |
COPY . .
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
ENV MUJOCO_GL=osmesa
|
| 33 |
-
ENV PYOPENGL_PLATFORM=osmesa
|
| 34 |
|
| 35 |
# Performance tuning
|
| 36 |
ENV OMP_NUM_THREADS=4
|
|
|
|
| 27 |
# Copy application code (including the static frontend directory)
|
| 28 |
COPY . .
|
| 29 |
|
| 30 |
+
# Enable GPU rendering for MuJoCo on HF (egl when GPU is available)
|
| 31 |
+
ENV NOVA_MUJOCO_GPU=1
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Performance tuning
|
| 34 |
ENV OMP_NUM_THREADS=4
|
mujoco_server.py
CHANGED
|
@@ -10,6 +10,19 @@ import traceback
|
|
| 10 |
import io
|
| 11 |
import cv2
|
| 12 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
import mujoco
|
| 14 |
from functools import wraps
|
| 15 |
from pathlib import Path
|
|
|
|
| 10 |
import io
|
| 11 |
import cv2
|
| 12 |
import numpy as np
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def _configure_mujoco_backend() -> None:
|
| 16 |
+
if os.environ.get("NOVA_MUJOCO_GPU", "").lower() in {"1", "true", "yes", "on"}:
|
| 17 |
+
os.environ["MUJOCO_GL"] = os.environ.get("MUJOCO_GL", "egl")
|
| 18 |
+
os.environ["PYOPENGL_PLATFORM"] = os.environ.get("PYOPENGL_PLATFORM", "egl")
|
| 19 |
+
else:
|
| 20 |
+
os.environ["MUJOCO_GL"] = os.environ.get("MUJOCO_GL", "osmesa")
|
| 21 |
+
os.environ["PYOPENGL_PLATFORM"] = os.environ.get("PYOPENGL_PLATFORM", "osmesa")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
_configure_mujoco_backend()
|
| 25 |
+
|
| 26 |
import mujoco
|
| 27 |
from functools import wraps
|
| 28 |
from pathlib import Path
|