atlasleong/ai-final-12-act-2-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

MidoriChou/ai_final_12_act_2 — LeRobot ACT on Ascend NPU (npu:6)

中文摘要:本目录交付 MidoriChou/ai_final_12_act_2(LeRobot ACT 模仿学习策略)在昇腾 Ascend 910B NPU(物理 npu:6)上的完整真实推理候选。模型权重严格使用固定 revision 的 真实检查点,全部模型参数、输入与输出均位于 npu:6,无 CPU 前向/offload。

1. Model introduction / source identity

FieldValue
Model IDMidoriChou/ai_final_12_act_2
Sourcehttps://huggingface.co/MidoriChou/ai_final_12_act_2
Pinned source revision92654eb0e3f9ee4329d54a599165aeb12512e92f
Architecture routeLeRobot ACT (Action Chunking with Transformers)
library_namelerobot
pipeline_tagrobotics
licenseapache-2.0 (declared in the upstream model card; not guessed)
Taskreinforcement-learning-policy / imitation-learning action chunking

The selected immutable real inference artifacts and their exact byte size / SHA256 (recorded by inference.py at every run, and verified before load):

ArtifactBytesSHA256
model.safetensors2067202249da5b06966343936951d917de0225b07db1ca40eba100f841918d4ef389a223d
policy_preprocessor_step_3_normalizer_processor.safetensors7756100b051bb60ceae799b22334e2c85a104c2c01c1438ac3b42276cd6b94db5f3f
policy_postprocessor_step_0_unnormalizer_processor.safetensors7756100b051bb60ceae799b22334e2c85a104c2c01c1438ac3b42276cd6b94db5f3f

The checkpoint (model.safetensors, 234 tensors, 51,602,312 parameters) is loaded strictly and completely (load_state_dict(..., strict=True), no partial / random / config-only / dummy substitute). The self-contained inference.py re-implements the exact LeRobot ACT module graph whose parameter names are frozen in the real checkpoint; the state dict matches 1:1. No lerobot, torchvision or Gym/Unity/robot hardware is used.

2. Hardware and environment dependencies

ComponentVersion / value (recorded from the real run)
NPU hardwareAscend 910B4 (Ascend910B4-1), physical device npu:6
NPU device count visible8
CANN8.5.1
torch2.9.0+cpu (CANN-matched, preinstalled)
torch_npu2.9.0 (CANN-matched, preinstalled)
Python3.11.14 (aarch64)
numpy1.26.4
safetensors0.8.0
npu-smi25.5.1
OS / platformLinux-5.10.0-325.0.0.226.oe2203sp4.aarch64-aarch64-with-glibc2.38

Hard execution policy (enforced by the script):

  • torch==2.9.0+cpu and torch_npu==2.9.0 are the container's CANN-matched pair and are never replaced with ordinary PyPI wheels.
  • CPU only orchestrates Python and deserializes the checkpoint initially. The model, vision backbone, transformer, VAE latent input projection and action-head forward all run on npu:6 — there is no CPU offload/fallback. Every model parameter, buffer, numeric input and tensor output is asserted to be on npu:6; any placement mismatch fails nonzero.

3. Dependencies and exact Aliyun-only install steps

Runtime dependencies are deliberately minimal (the script is self-contained). The CANN-matched torch / torch_npu pair is preinstalled and must not be reinstalled. Only the two non-torch runtime packages are installed through the configured Aliyun mirror:

# 1. (Recommended) Confirm the preinstalled CANN-matched pair is intact:
python3 -c "import torch, torch_npu; print(torch.__version__, torch_npu.__version__)"

# 2. Install only the non-torch runtime deps from the Aliyun PyPI mirror:
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt

requirements.txt in this directory lists safetensors>=0.8.0 and numpy==1.26.4 as the installable packages; the torch / torch_npu pair appears only as commented documentation so a plain pip install -r requirements.txt can never replace them.

4. Inference steps — step-by-step NPU operation

  1. Verify the NPU device (physical npu:6):
    npu-smi info
  2. Run the maintained NPU environment validator (optional but recommended):
    python3 /root/ascend-model-pipeline/upstreams/AscendSkills/ai4s-migration-base/scripts/check_npu_basics.py --device npu:6
  3. Run the real inference from this directory:
    cd /root/ascend-model-pipeline/jobs/rl26/ai-final-12-act-2/ai-final-12-act-2-npu
    NPU_HOLD_SECONDS=5 python3 inference.py
    • NPU_HOLD_SECONDS (default 5) controls the post-load hold window during which an external wrapper can run npu-smi info and correlate the exact live Python PID with physical npu:6 (see [MODELAGENT-READY] in the log and logs/ready.marker).
    • The script fails nonzero on any NPU init / placement / execution error; it never silently falls back to CPU.

Outputs produced in logs/:

FileContents
logs/npu_inference.logSanitized raw run log (header, artifact hashes, placement, hold-window npu-smi, action summary, exit).
logs/npu_result.jsonStructured result (top-level engine, npu_available, npu_device_name, source_revision, input_device, model_device, output_device, exit_code, output summary, timing, PID, package versions).
logs/ready.markerHold-window marker (pid, device, phase, timestamp, hold_seconds).
logs/fusion_result.jsonRaw CANN graph-fusion evidence from the real device run.

5. Complete test case and actual output

Test input (deterministic, redistributable, no external data download):

  • observation.state: [1, 9] float32 ramp in [-1, 1]
  • observation.images.wrist: [1, 3, 480, 640] float32 vertical intensity gradient in [0, 1]
  • observation.images.front: [1, 3, 480, 640] float32 horizontal intensity gradient in [0, 1]
  • Expected output: action chunk [1, chunk_size=100, action_dim=8]

Command (the exact final command used):

cd /root/ascend-model-pipeline/jobs/rl26/ai-final-12-act-2/ai-final-12-act-2-npu
NPU_HOLD_SECONDS=5 /usr/local/python3.11.14/bin/python3 inference.py

Actual output (verbatim lines from the real final run; full sanitized raw log in logs/npu_inference.log):

[2026-08-22 08:32:22] LeRobot ACT NPU inference candidate: MidoriChou/ai_final_12_act_2
[2026-08-22 08:32:22] python           : 3.11.14 (aarch64)
[2026-08-22 08:32:22] torch            : 2.9.0+cpu
[2026-08-22 08:32:22] torch_npu        : 2.9.0
[2026-08-22 08:32:22] CANN             : 8.5.1
[2026-08-22 08:32:26] device_count     : 8
[2026-08-22 08:32:26] device_name(npu:6) : Ascend910B4-1
[2026-08-22 08:32:26] artifact model.safetensors: size=206720224 (exp 206720224) sha256=9da5b06966343936951d917de0225b07db1ca40eba100f841918d4ef389a223d match=True
[2026-08-22 08:32:27] model state_dict : 234 tensors, 51602312 params (real checkpoint)
[2026-08-22 08:32:27] model placement  : all 51602312 params + 81 buffers on npu:6
[2026-08-22 08:32:27] [MODELAGENT-READY] pid=3354394 device=npu:6 phase=model_loaded_ready_for_forward hold=5.0s marker=.../logs/ready.marker
| 6       0                 | 3354394       | python3                  | 344                     |
[2026-08-22 08:32:40] action chunk output shape : [1, 100, 8] device=npu:6
[2026-08-22 08:32:40] action chunk first step    : [-0.129638, 0.549583, 0.031242, -2.11774, 0.126015, 2.650355, 0.64655, 0.498001]
[2026-08-22 08:32:40] action chunk mean per dim  : [-0.146151, 0.568257, 0.012587, -2.146448, 0.126753, 2.697549, 0.624008, -0.153322]
[2026-08-22 08:32:40] action chunk std  per dim  : [0.005591, 0.01203, 0.007403, 0.011298, 0.004157, 0.017387, 0.015511, 0.3911]
[2026-08-22 08:32:40] action chunk abs mean      : 0.838521
[2026-08-22 08:32:42] elapsed forward: 6.5500s  total: 17.6586s
[2026-08-22 08:32:42] SUCCESS: real ACT checkpoint executed on npu:6
[RESULT] exit_code=0 result_json=.../logs/npu_result.json

Key structured fields from logs/npu_result.json:

{
  "engine": "torch_npu",
  "exit_code": 0,
  "npu_available": true,
  "npu_device_name": "Ascend910B4-1",
  "source_revision": "92654eb0e3f9ee4329d54a599165aeb12512e92f",
  "input_device": "npu:6",
  "model_device": "npu:6",
  "output_device": "npu:6",
  "output": {
    "name": "action_chunk",
    "summary": {
      "shape": [1, 100, 8],
      "device": "npu:6",
      "dtype": "torch.float32",
      "first_step": [-0.129638, 0.549583, 0.031242, -2.11774, 0.126015, 2.650355, 0.64655, 0.498001],
      "abs_mean": 0.838521,
      "norm_chunk_abs_mean": 1.040815
    }
  },
  "timing": {"forward_s": 6.55, "total_s": 17.6586},
  "pid": 3354394
}

The live npu-smi line during the hold window (| 6 0 | 3354394 | python3 | 344 |) proves that the inference PID (3354394) is the exact process resident on physical NPU 6.

6. Reproducibility and determinism

  • The test inputs are deterministic (fixed ramps/gradients) and redistributable; no external dataset is downloaded.
  • The model runs in eval() mode (dropout disabled) with fixed seeds (torch.manual_seed(42), np.random.seed(42), random.seed(42)) and constrained CPU-side OpenMP/MKL thread pools (OMP_NUM_THREADS=1, MKL_NUM_THREADS=1, torch.set_num_threads(1)), which reduce thread-creation pressure on shared machines while the forward stays entirely on npu:6.
  • Multiple consecutive fresh runs (including the final run) produced bit-identical action summaries (same first_step, mean_per_dim, std_per_dim, abs_mean, etc.), confirming deterministic inference on npu:6.

7. Limitations

  • This is a policy forward benchmark of the trained LeRobot ACT policy (state + two camera images → action chunk). It does not launch Gym/Unity/robot hardware, and it does not run the training/ViT-VAE reconstruction path.
  • The test input is a deterministic synthetic observation, not a recorded episode frame.
  • Ascend910 does not support fp64; the model uses fp32 throughout.
  • The screenshot images are rendered from the real final transcript/log/result for evidence; they are documentation, not part of the inference runtime.
  • Publication is only "unverified" until every required file and tag is retrievable anonymously; this directory is a review/repair candidate and has not been published.

8. Evidence screenshots

All screenshots are rendered only from the real final transcript / sanitized log / result JSON. Nothing is fabricated.

ScreenshotContents
assets/agent_workflow.pngReal ModelAgent workflow steps from the actual turn transcript (read → audit → fix → verify → run).
assets/npu_device_call.pngReal npu-smi device table + live process line showing the inference PID on physical npu:6 during the hold window.
assets/model_result.pngReal logs/npu_result.json action-chunk result (shape, device, first step, summary stats, timing, PID).
assets/modelagent_live_session.pngReal ModelAgent live-session transcript excerpt (turn 1 final verification).

9. File manifest

inference.py
README.md            (byte-identical to readme.md)
readme.md            (byte-identical to README.md)
requirements.txt
SHA256SUMS
logs/npu_inference.log
logs/npu_result.json
logs/ready.marker
logs/fusion_result.json
assets/agent_workflow.png
assets/npu_device_call.png
assets/model_result.png
assets/modelagent_live_session.png