Skip to content

kscalelabs/kinfer-evals

Repository files navigation

kinfer-evals

Evals for kinfer policies using kmotions

Installation

# clone the repo
# cd into the repo root 
pip install -e . 

Usage

Run any motion from kmotions:

kinfer-eval /path/to/policy.kinfer robot-name motion-name --out /path/to/output

# For example, run the walking_and_standing_unittest motion
kinfer-eval ~/policies/frosty_feynman.kinfer kbot-headless walking_and_standing_unittest --out ~/eval_runs

# Other available motions: wave, salute, pickup, wild_walk, zombie_walk, squats, pirouette, backflip, boxing, etc.

The eval will:

  1. Load the motion from kmotions
  2. Run it until completion (when the motion returns None)
  3. Record all data to HDF5
  4. Generate plots and metrics
  5. Optionally publish results to Notion

Troubleshooting

"GL context" / headless rendering errors

If you see errors like:

  • ImportError: Cannot initialize a EGL device display … PLATFORM_DEVICE
  • ImportError: Cannot use OSMesa rendering platform …
  • AttributeError: 'NoneType' object has no attribute 'glGetError'
  • Symbol errors like GLIBCXX_3.4.30 not found, __malloc_hook, FunctionType

This is usually because:

  • The machine is a VM (no NVIDIA GPU) but the environment forces the NVIDIA EGL path (e.g., LD_PRELOAD=/usr/lib/.../libEGL_nvidia.so.0), so MuJoCo can't create a headless EGL context.
  • Or the environment mixes EGL and OSMesa variables.
  • Or Mesa/LLVM needs a newer libstdc++ than the one in your Conda env.

Recommended fix (VM / no GPU: use software OSMesa)

Use the kinfer-evals/kinfer_evals/scripts/run_eval_osmesa.sh script to run the eval, it basically does the following:

# pick one: put these in your wrapper script or export before running
export MUJOCO_GL=osmesa
export PYOPENGL_PLATFORM=osmesa
export PYOPENGL_OSMESA_LIBRARY=/usr/lib/x86_64-linux-gnu/libOSMesa.so.8

# keep EGL/NVIDIA bits out of the way
unset LD_PRELOAD __EGL_VENDOR_LIBRARY_FILENAMES EGL_PLATFORM DISPLAY

# if you see 'GLIBCXX_3.4.30 not found', do ONE of the following:
# (A) quick workaround:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
# (B) better: upgrade Conda runtime so preload is unnecessary:
# conda install -n <env> -c conda-forge "libstdcxx-ng>=12" "libgcc-ng>=12"

If you actually have an NVIDIA GPU (use EGL)

export MUJOCO_GL=egl
unset PYOPENGL_PLATFORM  # don't set 'osmesa' here
# optional: point GLVND at NVIDIA's JSON if needed
# export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_nvidia.json

Sanity check

python - <<'PY'
from mujoco import gl_context
gl_context.GLContext(64, 64)
print("MuJoCo GLContext OK")
PY

If this prints "OK", your GL stack is configured correctly.

About

Evals for kinfer policies

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •