lingbot-sn80-workspace / 1gpu /docker /client.Dockerfile
salpu's picture
1-GPU box: eval harness wired+corrected, LoRA export merge fix, utilisation profiling, findings
3922a1b verified
Raw History Blame Contribute Delete
5.46 kB
# LIBERO simulation client for SN80 eval.
#
# Kept as a SEPARATE image from the policy server on purpose: LIBERO pins
# numpy 1.22.4 / transformers 4.21 / torch 1.11, which cannot coexist with the
# training image's numpy 1.26 / transformers 4.57 / torch 2.8. That is the same
# split openroboto-evaluation uses - sim client here, policy over websocket.
#
# Adapted from openpi/examples/libero/Dockerfile, which already solves the two
# things that otherwise bite:
# * LIBERO prompts interactively on first import unless LIBERO_CONFIG_PATH
# points at a prewritten config.yaml.
# * MuJoCo needs an EGL ICD; the CUDA runtime base ships none. The actual
# driver libs come from the host at run time via
# NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics.
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /uvx /bin/
RUN apt-get update && apt-get install -y --no-install-recommends \
make g++ clang \
libosmesa6-dev libgl1-mesa-glx libegl1 libglew-dev libglfw3-dev \
libgles2-mesa-dev libglib2.0-0 libsm6 libxrender1 libxext6 \
python3-dev python3.8-dev \
&& rm -rf /var/lib/apt/lists/*
# python3.8-dev supplies Python.h; needed to build evdev (a robosuite ->
# LIBERO transitive dependency) from source, since uv's own portable Python
# 3.8 ships no dev headers of its own.
WORKDIR /app
ENV UV_LINK_MODE=copy
ENV UV_PROJECT_ENVIRONMENT=/.venv
COPY requirements.txt /tmp/requirements.txt
COPY requirements-libero.txt /tmp/requirements-libero.txt
COPY openpi-client /tmp/openpi-client
RUN uv venv --python 3.8 $UV_PROJECT_ENVIRONMENT
# gym==0.25.2 (a 2022-era package) fails to build under uv's default build
# isolation because uv fetches a modern setuptools whose _distutils_hack is
# not Python-3.8-compatible (TypeError: 'type' object is not subscriptable
# while gym's setup.py bootstraps distutils). --build-constraints pins an old
# setuptools into gym's isolated build environment only, not the final venv.
RUN echo "setuptools==65.5.0" > /tmp/build-constraints.txt
# evdev (a robosuite -> real-hardware-teleop transitive dep, unused for
# scripted LIBERO eval but still resolved and built) needs Python.h. Ubuntu
# jammy ships no python3.8-dev package at all (apt silently no-ops instead of
# erroring on the missing name) - but uv's OWN managed CPython 3.8.20 build
# already includes its headers; the build backend just isn't finding them.
# Point the compiler at them explicitly.
ENV CPATH=/root/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8
RUN uv pip sync /tmp/requirements.txt /tmp/requirements-libero.txt \
/tmp/openpi-client/pyproject.toml \
--extra-index-url https://download.pytorch.org/whl/cu113 \
--index-strategy=unsafe-best-match \
--build-constraint /tmp/build-constraints.txt
# LIBERO + LIBERO-PRO + the openpi client sources live under /app.
COPY libero /app/third_party/libero
COPY libero-pro /app/third_party/libero-pro
COPY openpi-client /app/packages/openpi-client
COPY main.py /app/examples/libero/main.py
ENV PYTHONPATH=/app:/app/packages/openpi-client/src:/app/third_party/libero
# Prewritten so LIBERO's __init__ never prompts.
ENV LIBERO_CONFIG_PATH=/tmp/libero
RUN mkdir -p /tmp/libero && printf '%s\n' \
'benchmark_root: /app/third_party/libero/libero/libero' \
'bddl_files: /app/third_party/libero/libero/libero/bddl_files' \
'init_states: /app/third_party/libero/libero/libero/init_files' \
'datasets: /app/third_party/libero/libero/datasets' \
'assets: /app/third_party/libero/libero/libero/assets' \
> /tmp/libero/config.yaml
# EGL ICD pointing at the driver lib below.
RUN mkdir -p /usr/share/glvnd/egl_vendor.d && \
printf '%s' '{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_nvidia.so.0"}}' \
> /usr/share/glvnd/egl_vendor.d/10_nvidia.json
# NVIDIA's EGL/GLX userspace libraries, vendored into the image, because this
# host runs a compute-only datacenter driver install: `--gpus all` +
# NVIDIA_DRIVER_CAPABILITIES=graphics mounts NOTHING for EGL here, because the
# HOST ITSELF has no libEGL_nvidia.so.0 anywhere on its filesystem - confirmed
# by `find / -iname libEGL_nvidia*` on the host coming back empty. Without
# this, MjRenderContextOffscreen raises "Cannot initialize a EGL device
# display... does not support the PLATFORM_DEVICE extension" on first
# env.reset(), i.e. only once real rendering is attempted - every earlier
# import succeeds, which makes this look like a rendering-logic bug rather
# than a missing-library one.
#
# Fix: extract ONLY the userspace GL/EGL libs (not the kernel module, not the
# CUDA driver, not the installer's dkms/nvidia-smi bits) from the tesla/ .run
# matching this host's exact driver version, via --extract-only:
# 580.126.20: https://us.download.nvidia.com/tesla/580.126.20/NVIDIA-Linux-x86_64-580.126.20.run
# ./NVIDIA-Linux-x86_64-580.126.20.run --extract-only --target /tmp/x
# then take libEGL_nvidia.so, libnvidia-eglcore.so, libnvidia-glcore.so,
# libnvidia-glsi.so, libnvidia-tls.so, libnvidia-gpucomp.so, libGLX_nvidia.so,
# libglxserver_nvidia.so. MUST match the host driver version exactly - these
# are not forward/backward compatible across driver releases. Re-extract and
# rebuild if the host driver is ever upgraded.
COPY nvidia-egl-libs /opt/nvidia-egl
ENV LD_LIBRARY_PATH=/opt/nvidia-egl
ENV MUJOCO_GL=egl
ENV PYOPENGL_PLATFORM=egl
CMD ["/bin/bash"]