w
gcw_uQ09W7jl/smolvla_metaworld-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

lerobot/smolvla_metaworld NPU Adaptation

  • Original Model: lerobot/smolvla_metaworld
  • Base Model: lerobot/smolvla_base
  • VLM Backbone: HuggingFaceTB/SmolVLM2-500M-Video-Instruct
  • Revision: cd6778d2cfa724c1bf5fc637490548e54d81dc4c
  • Route: manipulation-vla (image/state/language → continuous action_chunk)
  • License: apache-2.0
  • Hardware: Ascend NPU (910_9362) via torch_npu

Task

Vision-Language-Action for MetaWorld multi-task manipulation (MT50). The policy consumes 3 camera images (256×256), proprioceptive state (4-dim, normalized) and language instruction, and predicts a 50-step action chunk (4-DoF continuous control for MetaWorld) via flow matching with 10 diffusion steps.

Observation and Action Contract

  • Inputs (deterministic demo):
    • observation.state: float32 tensor torch.Size([1, 4]) example [0.033..., 0.012..., 0.023..., 0.023...] on cpu/npu:0, normalized via MEAN_STD (mean [0.014, 0.640, 0.162, 0.613], std [0.112, 0.103, 0.087, 0.299])
    • observation.images.camera1/2/3: float32 torch.Size([1, 3, 256, 256]) in [0,1] → preprocessed to 512×512 with padding → normalized [-1,1] for SigLIP
    • task: ["push the button"] → tokenized to 48 tokens via HuggingFaceTB/SmolVLM2-500M-Video-Instruct tokenizer (attention mask)
    • fixed_noise: torch.Size([1, 50, 32]) sampled with seed=0 for deterministic CPU/NPU comparison
  • Output:
    • action_chunk: float32 torch.Size([1, 50, 4]) on cpu/npu:0, finite, 4-DoF
    • Example CPU first action: [-0.503..., -1.780..., -0.763..., -0.164...] last [-0.147..., -0.314..., -0.818..., 0.313...]
    • NPU first [-0.5031085, -1.7800269, -0.7634159, -0.1643544] last [-0.1474617, -0.3145535, -0.8188937, 0.3133597]

CPU-NPU Consistency

  • Shared weights from /opt/atomgit/adapt-npu-agent/working/models/smolvla_metaworld/model.safetensors (865 MB), same raw observations, same preprocessor (tokenizer, normalizer, resize), same seed=0 noise, dtype=torch.float32, num_steps=10.
  • torch.npu.synchronize() surrounds every timed forward.
  • Result: 200 scalar values (50×4), max_abs=0.000017, mae=0.000002, max_ref=1.780026
  • Tolerances: strict FP32 1e-4+1e-3*ref = 0.001880 → PASS, BF16 5e-3+5e-2*ref = 0.094001 → PASS, finite=True, shape_match=True.
  • Device proof logged: model param npu:0, observation.state npu:0, images npu:0, tokens npu:0, noise npu:0, action npu:0.

Performance

  • Batch 1, horizon 50, 10 flow steps, dtype FP32, NPU npu:0 Ascend910_9362:
    • First compiled latency: 536.46 ms (includes compilation)
    • Warmup 3 + measured 10 runs: avg 262.38 ms, min 250.00 ms, max 272.33 ms, p50 264.05 ms, p90 270.96 ms, p95 272.33 ms
    • Throughput: 3.81 chunks/s, 190.57 actions/s (scalar, 4-dim), actions_per_s (chunks*dim)=762.26 inclusive
  • CPU and NPU use identical sampling; no CPU fallback.

Environment Constraints

  • Single-card Ascend 910_9362 (64 GB), 450 M params fits single NPU.
  • HF_ENDPOINT=https://hf-mirror.com, no manual proxy override, num2words required for SmolVLM processor.
  • State dim note: config lists 6 but normalizer expects 4 for MetaWorld; inference uses correct 4-dim state to match training statistics.

Usage

pip install -r requirements.txt
python inference.py

Default python inference.py loads from local working/models/smolvla_metaworld or HF cache and prints device, dtype, action summaries, consistency and benchmark, ending with PASS.

Evidence

agent workflow npu device call model result