AGENT SKILL

dataviewer-annotate

One-shot: launch the dataviewer with the VLM judge enabled and run the multi-step VLM-as-judge pipeline across an entire dataset. Use when the user runs /dataviewer-annotate.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 138
Forks
72

01 前言 Front Matter

name
dataviewer-annotate
description
One-shot: launch the dataviewer with the VLM judge enabled and run the multi-step VLM-as-judge pipeline across an entire dataset. Use when the user runs /dataviewer-annotate.
argument-hint
<datasetId> [mode=vlm-judge] [backend=qwen3-vl|echo|openai-compat] [modelId=...] [baseUrl=...] [persistLabels=true|false] [limit=N]
disable-model-invocation
true

03 SKILL.md 正文

Dataviewer Annotate

Launch the dataviewer, ensure the VLM-as-judge harness is enabled, and score dataset episodes with the chosen judge backend.

This workflow follows Phase 5 ("VLM-as-Judge Evaluation") of the Dataviewer Developer agent and the dataviewer skill. Run it from that agent when available; from another agent, read both files first.

Arguments

Parse arguments from the request. The first bare value is datasetId; the rest are name=value pairs. Use the default when an argument is omitted.

  • datasetId (required): Subdirectory name under DATA_DIR. Aliases accepted (leisaac-pickup-orange → leisaac-pick-orange).
  • mode (default vlm-judge): Annotation mode. Currently only vlm-judge is supported. Reserved for future modes (e.g. joint-trajectory).
  • backend (default qwen3-vl): One of qwen3-vl, echo, or openai-compat. With qwen3-vl, this workflow auto-launches the local OpenAI-compat shim so the dataviewer talks to the model via HTTP without colocating Torch in the dataviewer venv.
  • modelId (default Qwen/Qwen3-VL-4B-Instruct): Hugging Face id (qwen3-vl) or remote model name (openai-compat).
  • baseUrl (optional): OpenAI-compatible endpoint when backend=openai-compat; ignored otherwise.
  • persistLabels (default true): When true and the model returns a binary outcome with confidence ≥ 0.7, set the dataviewer label to SUCCESS / FAILURE (or PARTIAL for mid-confidence). Skipped on outcome_success: null.
  • limit (default 0): Cap on number of episodes; 0 means the entire dataset.

Requirements

Drive the Dataviewer Developer agent through Phase 5 ("VLM-as-Judge Evaluation"). Reuse running services only when their dataset, model, and backend settings match this request. Do not stop processes the workflow does not own.

The URLs below use default ports. Substitute the resolved service URLs consistently when different ports are requested.

  1. Resolve aliases for datasetId:

    • leisaac-pickup-orange → leisaac-pick-orange
    • cnc → cnc_lerobot
    • ur10e → ur10e_episodes
    • Otherwise pass through verbatim. Confirm the resolved id exists as ${DATA_DIR}/<id> before continuing.
  2. Resolve session-only settings for the viewer's child process. Do not rewrite backend/.env unless persistent defaults are explicitly requested:

    DATA_DIR=<resolved absolute dataset parent>
    DATAVIEWER_AUTH_DISABLED=true
    
    VLM_JUDGE_ENABLED=true
    VLM_JUDGE_BACKEND=<backend>
    VLM_JUDGE_MODEL_ID=<modelId>
    VLM_JUDGE_BASE_URL=<resolve below>
    VLM_JUDGE_N_FRAMES=12
    VLM_JUDGE_CACHE_DIR=outputs/vlm-judge/cache
    

    Resolve VLM_JUDGE_BASE_URL:

    • backend=qwen3-vl → http://127.0.0.1:8001/v1 (the shim) and pass VLM_JUDGE_BACKEND=openai-compat so the dataviewer's lightweight venv doesn't try to load Torch.
    • backend=openai-compat → baseUrl exactly as provided. Fail fast if missing.
    • backend=echo → leave unset.

    Use existing protected credentials for remote endpoints; never replace an API key with a placeholder. Disable authentication only for an owned loopback development session. Preserve authentication and CSRF requirements on existing authenticated services.

  3. Launch the model server when backend=qwen3-vl:

    • Probe GET http://127.0.0.1:8001/health and /v1/models. Reuse the service only when it is healthy and exposes the requested model.

    • If another process owns the port with different settings, stop and ask before proceeding.

    • Otherwise start the shim in a background terminal from the root .venv (it has Torch + transformers):

      cd <repo> && source .venv/bin/activate && \
        PYTHONPATH="$PWD:$PWD/evaluation" \
        python -m evaluation.vlm_judge.openai_shim --port 8001 --model-id <modelId>
      
    • Wait for /health to return {"status":"ok"} before continuing.

  4. Launch or reuse the dataviewer:

    • Probe GET http://localhost:8000/health and GET /api/datasets/<id>/capabilities. Reuse a matching instance only when vlm_judge_enabled is true.

    • Otherwise restart only an owned instance. If another process owns the requested ports, stop and ask before proceeding. Pass the resolved settings from step 2 through the child process environment, then run

      cd data-management/viewer && ./start.sh --data-dir "${DATA_DIR}"
      

      start.sh already exports PYTHONPATH to include the evaluation package when VLM_JUDGE_ENABLED=true. Wait for both services to become ready, and follow the dataviewer skill's accepted-dataset checks when a descriptor is present.

  5. Open the dataviewer UI at http://localhost:5173:

    • Find browser tools with the host's tool search as described in the dataviewer skill's "Load browser automation tools" step. Try the integrated browser (open_browser_page) first; if SimpleBrowser flakes or is unavailable, fall back to the Playwright MCP navigate action (browser_navigate).
    • Switch to the resolved dataset via the header combobox (use the [role="option"] JS pattern documented in the dataviewer skill).
  6. Iterate the dataset:

    • Fetch /api/datasets/<id>/episodes?limit=1000 to enumerate. Apply limit if non-zero.
    • For each episode index idx:
      1. Probe GET /api/datasets/<id>/episodes/<idx>/judge (cache check).
      2. If result == null, POST it with {"force": false} and the dataviewer's CSRF cookie/header.
      3. When persistLabels is true and result.outcome_success is not null, derive the label:
        • outcome_success == true and outcome_confidence >= 0.7 → SUCCESS
        • outcome_success == false and outcome_confidence >= 0.7 → FAILURE
        • otherwise → PARTIAL Read the latest dataset labels and ETag, preserve unrelated labels, and replace the outcome label with the selected value. Send PUT /api/datasets/<id>/episodes/<idx>/labels with If-Match: <ETag>, or If-None-Match: * when no ETag exists, plus required authentication and CSRF headers. Successful PUT requests persist immediately. Stop and reconcile HTTP 412 conflicts; do not retry with stale state. Verify the saved labels with GET instead of issuing a separate save request.
    • Stream progress to the user every ~10 episodes (e.g. 15/60 done — 11 SUCCESS, 4 FAILURE, mean VOC 0.62).
  7. Verify in the UI by navigating the browser to a randomly chosen sample episode in the resolved dataset and asserting the VLM Judge panel renders an outcome badge.

  8. Report:

    • Total episodes scored, success rate, mean VOC, mean inference latency.
    • Distribution of failure_mode values.
    • Output cache directory (outputs/vlm-judge/cache/) and how many entries it now holds.
    • Any 4xx/5xx responses with the offending episode index.
    • URL to the running UI for hand-review.

Recovery hints

  • 502 "VLM backend error: 422 …" from the dataviewer means the shim's request body model isn't being recognised — restart the shim; the fix is already in evaluation/vlm_judge/openai_shim.py (module-scope Pydantic models).
  • Process format violation (model returns wrong-length array) is a known soft failure: the harness logs a warning and falls back to zeros for that episode. Continue.
  • Milestone format violation for {"milestones": []} is cosmetic; the model legitimately found no milestones and the parser is intentionally strict.
  • No GPU memory (CUDA OOM): retry with a smaller modelId (e.g. Qwen/Qwen3-VL-2B-Instruct) or offload to openai-compat against an external endpoint.

04 同仓库更多 Skills