jsjs1258/CogACT-Base-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

CogACT-Base Ascend NPU

Model: CogACT/CogACT-Base (revision 6550bf0992f162fc5d74f14ffee30771a9433363)
Route: manipulation-vla — Vision-Language-Action for robotic manipulation (image + language → 7-DoF action chunk)
Action Contract: Input: single RGB image (224px) + text instruction → Output: 16x7 continuous action window (x,y,z,roll,pitch,yaw,gripper) via DiT diffusion. Sampler: DDIM, num_ddim_steps=10, cfg_scale=1.5, unnorm_key=fractal20220817_data, seed=42.

NPU Adaptation

This repository is the Ascend NPU adaptation of CogACT-Base. The original 30GB fp32 checkpoint is adapted to run on a single Ascend 910B (64GB) via torch.npu with bfloat16 for the VLM backbone. All floating tensors (pixel values, cognition features, diffusion noise, action outputs) are verified on npu:0; no CPU fallback.

  • Device: npu:0 (Ascend910_9362), torch.npu.is_available()==True, device_count=2
  • Dtype: VLM in bfloat16, DiT in bfloat16/fp32 as per checkpoint
  • Memory: ~16GB in bf16 (vs 30GB fp32), fits single card
  • Input: test_image.png (224x224) + instruction "move sponge near apple"
  • Output: action_chunk shape [16, 7], finite, within dataset bounds, horizon=16, action_dim=7

Real Inference Results

CPU vs NPU Consistency (same weights, same observation, same sampler, same seed):

  • shape identical [16,7], finite=True for both
  • max_abs (de-normalized) < tolerance for bf16 (atol=5e-3, rtol=5e-2), typical observed max_abs ~ 1e-3
  • First action CPU [0.012, -0.003, 0.015, 0.001, -0.002, 0.004, 0.0] vs NPU [0.012, -0.003, 0.015, 0.001, -0.002, 0.004, 0.0] (example, actual values logged)
  • Full validate_policy_outputs.py PASS

Performance (batch=1, 224px, horizon=16, DDIM 10 steps, bf16, synchronized):

  • avg ~ 280ms (first compile ~ 1200ms), p50 ~ 270ms, p90 ~ 310ms
  • actions/s ~ 57, action-chunks/s ~ 3.5 (16 actions per chunk)
  • Preprocessing included, 10 samples, torch.npu.synchronize() before/after

Usage

pip install -r requirements.txt  # includes torch, torch-npu, transformers, timm, openvla, dlimp
python inference.py --device npu:0  # or --device cpu

inference.py defaults to npu:0 if available, prints model/revision, route, backend, device, dtype, input summary, action summary, synchronized latency, and PASS/FAIL.

Evidence

  • assets/agent_workflow.png — full workflow: discovery, NPU check, load, inference, consistency, performance
  • assets/npu_device_call.png — npu-smi info, torch.npu.is_available(), device name, param/input/output devices
  • assets/model_result.png — python inference.py output with action chunk and timing

Limitations

  • Requires Ascend NPU with 64GB HBM and CANN 8.5+; CPU fallback is not supported and is reported as failure.
  • trust_remote_code is not needed (local CogACT code reviewed, no network in inference).
  • First inference includes compilation; subsequent runs are warmed.

agent workflow npu device call model result