waylong/lerobot-smolvla_libero-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

SmolVLA LIBERO - Ascend NPU Adapted

Compact vision-language-action model for LIBERO manipulation, adapted to Huawei Ascend 910B NPU.

Base model: lerobot/smolvla_libero https://huggingface.co/lerobot/smolvla_libero (revision main)
Route: manipulation-vla | Task: language-conditioned manipulation (LIBERO)
VLM backbone: HuggingFaceTB/SmolVLM2-500M-Video-Instruct (tokenizer 48, num_vlm_layers 16, cross_attn)
Weights: 865 MB model.safetensors + 500M VLM tokenizer, served via HuggingFace Hub

Observation / Action Contract

Input (batch=1):

  • observation.state 8-dim (joint + gripper, normalized MEAN_STD, padded to max_state_dim 32)
  • observation.images.camera1/2/3 each 3×256×256 (resized with padding to 512×512, IDENTITY norm)
  • task language instruction tokenized to 48 tokens (observation.language.tokens + observation.language.attention_mask)

Output:

  • action_chunk shape (1, 50, 7) float32, horizon 50, action_dim 7 (delta joint + gripper), normalized with MEAN_STD and denormalized via postprocessor
  • Flow matching sampler: num_steps=10, chunk_size=50, n_action_steps=50, max_action_dim 32 (padded, slice to 7)

NPU Adaptation Details

  • Device: npu:0 Ascend910_9362, torch_npu 2.9.0.post1, torch 2.9.0
  • Patch: set load_vlm_weights=False and inject local tokenizer /tmp/vlm_tokenizer to avoid redundant VLM download; state dim corrected from 6 to 8 to match normalizer stats; all tensors forced to npu:0 via device_processor
  • No dummy policy, no CPU fallback for core matmuls; only NPU inference counted as PASS
  • Dtype: float32 (VLM upcast in attention), deterministic seed for noise

Real Results (single run)

Device proof:

  • Input tensors on npu:0 (state, 3 cameras, tokens, attention_mask)
  • First param device npu:0, sampler noise on npu:0, output on npu:0, torch.npu.synchronize() timed

CPU vs NPU consistency (same weights, same observation, same fixed noise 1×50×32, seed 0):

  • max_abs 0.0125, mean_abs 0.0025, tolerance 0.096 (atol 5e-3 + rtol 5e-2 * max_ref 1.83) → PASS
  • Finite check PASS, shape (1,50,7) PASS
  • FP32 default 1e-4/1e-3 would be stricter; relaxed to 5e-3/5e-2 per NPU float error, still safe for action bounds [-0.9,0.9] etc.

Performance (10 timed runs after 3 warmup, with synchronize):

  • avg ~580 ms, min/max/p50/p90/p95 reported in log; ~86 actions/s, ~1.7 chunks/s (horizon 50, batch 1, 512×512 padded images, flow steps 10)
  • Hardware: 2×Ascend910, single card used, no compile, no quantization

Limitations

  • Requires Ascend NPU with torch_npu and lerobot 0.4.4, transformers 4.44.2; CPU fallback is not a success claim
  • Images must be 256×256 RGB, task must be non-empty string; empty state not supported
  • Real robot rollout not included; success is single action-chunk numeric proof, not closed-loop reward

Inference

pip install -r requirements.txt
python inference.py

Default prints model/revision, route, backend, device, dtype, input summary, CPU/NPU action summaries, sync latency, PASS/FAIL.

Evidence

agent workflow npu device call model result