Skip to content

About

Repo containing patched groot policy erver install

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

groot-policy-server

A patched LeRobot async-inference PolicyServer for GR00T N1.7 checkpoints (e.g. PANDA-HSP/groot17-panda-ee-*). The robot client connects over gRPC, sends observations, and receives action chunks.

It is the stock lerobot.async_inference.policy_server (lerobot 0.6.1) with two runtime patches in run_policy_server_patched.py. Nothing in the installed lerobot package is edited.

Patch Problem with the stock server Fix
Whole-chunk postprocessing The stock server calls the postprocessor once per action step. GR00T N1.7's relative-action decoding needs the whole (B, chunk, action_dim) chunk at once, so every inference fails with NotImplementedError. The postprocessor is called once on the full chunk.
Release old policy before reload Each client connection reloads the checkpoint, and the new model is built while the old one is still on the GPU. That doubles memory (about 2 × 12 GB) and the second trial dies with CUDA OOM on a 24 GB card. The previous policy is freed and the CUDA cache emptied before loading. A reconnect costs about 10 s of reload time.

Requirements

  • Linux x86_64 with an NVIDIA GPU. The model needs about 15 GB of GPU memory, so 24 GB or more is recommended. Other jobs on the same GPU can cause OOMs.
  • NVIDIA driver ≥ 580 (CUDA 13) for the pinned torch 2.11 wheels. For older drivers, see Older drivers.
  • Python 3.12
  • About 10 GB of disk for the venv, plus the Hugging Face model cache (~/.cache/huggingface)
  • Network access to the Hugging Face Hub on the first load of each checkpoint. For private checkpoints run hf auth login (from the venv: .venv/bin/hf auth login) or set HF_TOKEN.

Install

git clone <this-repo-url> groot-policy-server
cd groot-policy-server
./install.sh --aliases      # creates ./.venv, installs pinned deps, adds shell aliases
source ~/.bash_aliases

install.sh options:

Option / env Effect
(default) Installs the exact tested versions from requirements-lock.txt
--unpinned Installs lerobot[async,groot]==0.6.1 and lets pip pick the newest compatible dependencies
--aliases Adds start-/stop-/status-/log-policy-server aliases to ~/.bash_aliases (can also be run later with scripts/install-aliases.sh)
PYTHON=/path/to/python3.12 Interpreter used to create the venv
TORCH_INDEX_URL=... Extra pip index for a different torch CUDA build

install.sh creates .venv with the first method that works: python3.12 -m venv, then uv, then conda (conda create -p .venv python=3.12). On Ubuntu the system python3.12 usually lacks venv unless python3.12-venv is installed. Without sudo, uv or miniconda is enough.

To reuse an existing environment that already has lerobot[async,groot]==0.6.1, skip install.sh. Copy server.env.example to server.env and set PYTHON= to that env's python.

Use

Alias Script What it does
start-policy-server ./start.sh Starts in the background, refuses if already running or if the port is taken
stop-policy-server ./stop.sh Stops it (SIGTERM, then SIGKILL after 10 s)
status-policy-server ./status.sh Shows running/stopped, GPU memory, connected clients, loaded checkpoints, number of action chunks, latency and errors
log-policy-server tail -f logs/latest.log Follows the live log

Settings live in server.env (created from server.env.example, not committed):

PYTHON=                 # empty = ./.venv/bin/python
HOST=0.0.0.0
PORT=8080
FPS=10
CUDA_VISIBLE_DEVICES=0
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True

You can override any of them for a single run: PORT=8081 CUDA_VISIBLE_DEVICES=1 start-policy-server.

The client chooses the checkpoint, chunk size and device. The server loads whatever the client asks for when it connects, so there is no model setting on the server side.

Client

From the robot machine, run the standard lerobot async-inference client against <server-ip>:8080, with policy_type=groot and pretrained_name_or_path=PANDA-HSP/groot17-.... See the lerobot async-inference docs.

What a healthy run looks like

status-policy-server, or logs/latest.log:

Client ipv4:192.168.x.x:NNNNN connected and ready
Receiving policy instructions ... Pretrained name or path: PANDA-HSP/groot17-... | Actions per chunk: 40
Time taken to put policy on cuda: 9.5 seconds        # ~90 s the first time (download)
Running inference for observation #0 (must_go: True)
Preprocessing and inference took 0.057s, action shape: torch.Size([1, 40, 7])
Action chunk #0 generated | Total time: 66ms
...
Previous policy released before loading the next one   # on every reconnect after the first

Troubleshooting

  • CUDA out of memory in Error in StreamActions: the GPU doesn't have enough free memory for the model (about 15 GB) plus inference. Run nvidia-smi to find other processes on that GPU, then move them or pick a free GPU with CUDA_VISIBLE_DEVICES.
  • Port 8080 is already in use: another server is running. Stop it, or use PORT=.... The client must use the same port.
  • NotImplementedError during inference: you're running the stock server, not run_policy_server_patched.py.
  • The first connection is slow (about 90 s): the checkpoint is downloading from the Hub. After that it loads from ~/.cache/huggingface.

Older drivers

The pinned torch 2.11 wheels from PyPI are built for CUDA 13 and need driver ≥ 580. With an older driver, install unpinned against a matching PyTorch index, e.g. for CUDA 12.8 (driver ≥ 570):

TORCH_INDEX_URL=https://download.pytorch.org/whl/cu128 ./install.sh --unpinned

Files

run_policy_server_patched.py   patched launcher (same CLI as lerobot's policy_server)
install.sh                     venv + dependencies + sanity check
start.sh / stop.sh / status.sh run control
server.env.example             per-machine settings template
requirements.txt               minimal spec: lerobot[async,groot]==0.6.1
requirements-lock.txt          exact tested versions (pip freeze, Python 3.12, CUDA 13)
scripts/install-aliases.sh     shell aliases
logs/  run/  .venv/            created at runtime, not committed

About

Repo containing patched groot policy erver install

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages