MidoriChou/ai_final_12_act_292654eb0e3f9ee4329d54a599165aeb12512e92f)ACTPolicy (Action Chunking Transformer, lerobot) - ResNet18 vision backbone (FrozenBatchNorm2d) + 4-layer Transformer encoder + 1-layer decoder, VAE latent_dim 32, dim_model 512, n_heads 8, dim_ff 3200pipeline_tag: robotics - 预测动作块 [batch, 100, 8] (chunk_size 100, n_action_steps 100), 输入为本体状态 [9] + 2 相机 RGB front/wrist [3,480,640]; 输出在真实 SO100 follower 上经由 lerobot-record 执行model.safetensors (206.7 MB 含 preprocessor/postprocessor, 51.6M 参数, float32)MidoriChou/ai_final_12 (cupstacking), 归一化 MEAN_STD for VISUAL/STATE/ACTION, 预处理 policy_preprocessor_step_3_normalizer_processor.safetensors 含各特征 mean/std, 后处理 policy_postprocessor_step_0_unnormalizer_processor 还原动作备注: 系统任务标签为“表格数据”,但实际仓库配置与权重为 robotics ACT 模型(
config.json type=act)。本仓按真实模型语义验证并交付 NPU 推理,不以“表格”方式虚构结果。
npu:0, 名称 Ascend910_9362, torch.npu.is_available()==True, device_count 2, dtype float32/tmp/midori_act2 由 HF_ENDPOINT=https://hf-mirror.com huggingface-cli download MidoriChou/ai_final_12_act_2 --local-dir /tmp/midori_act2 一次性下载固定 revision, 正式推理仅从本地加载不联网seed=42, observation.state [1,9] observation.images.front/wrist [1,3,480,640] 全为正态随机 (可复现), 计时前后 torch.npu.synchronize()pip install -r requirements.txt
# 包含: torch==2.9.0 torch-npu torchvision transformers safetensors huggingface_hub lerobot==0.4.4 einops draccus numpy Pillow# 默认推理(真实 npu:0 执行, 打印任务输出与 PASS)
python inference.py
# 一致性验证(同输入同权重 CPU vs NPU action chunk diff)
python inference.py --mode validate
# 性能基准(3 次 warmup + 10 次同步计时)
python inference.py --mode benchmark
# 指定本地权重目录(可选)
python inference.py --model-dir /tmp/midori_act2python inference.py (npu:0, float32, seed 42):
Model: MidoriChou/ai_final_12_act_2
Model dir: /tmp/midori_act2
Weight URL: https://huggingface.co/MidoriChou/ai_final_12_act_2
Task: robotics ACT (action chunking transformer, vision ResNet18 + Transformer)
Loading backend: lerobot ACTPolicy (avoiding ResNet pretrained download)
Device: npu:0 torch_npu available: True
Device name: Ascend910_9362
Device count: 2
Dtype: float32
Config: chunk_size=100 n_action_steps=100 dim_model=512 n_heads=8 input [state 9 + 2x 480x640] output [100,8]
Model loaded: ACTPolicy (ACT) params: 51.60M
Model param device: npu:0
Backbone: resnet18 pretrained_weights=None
Input features: {'observation.state': PolicyFeature(type=<FeatureType.STATE: 'STATE'>, shape=(9,)), 'observation.images.wrist': PolicyFeature(type=<FeatureType.VISUAL: 'VISUAL'>, shape=(3, 480, 640)), 'observation.images.front': PolicyFeature(type=<FeatureType.VISUAL: 'VISUAL'>, shape=(3, 480, 640))}
Output features: {'action': PolicyFeature(type=<FeatureType.ACTION: 'ACTION'>, shape=(8,))}
Input batch: state [1, 9] front [1, 3, 480, 640] wrist [1, 3, 480, 640] device=npu:0
Output action chunk shape: [1, 100, 8] dtype=torch.float32 device=npu:0
Actions stats: min -1.0378 max 0.5410 mean -0.4532 std 0.5240
First action step (0): [0.5144097805023193, -0.8820395469665527, 0.1496983915567398, -1.0286544561386108, -0.8320924639701843, -0.18682166934013367, -0.8403946161270142, -0.5141306519508362]
Last action step (99): [0.5188236236572266, -0.834748387336731, 0.13544824719429016, -1.00600266456604, -0.8110915422439575, -0.1453414112329483, -0.8415082097053528, -0.5329388380050659]
Inference latency (synchronized, include transformer + ResNet18): 227.63 ms (first compile) / ~24 ms steady
PASSnpu:0 参数设备已验证, 输出形状符合 ACT chunk 100×8。python inference.py --mode validate (seed 42, 同输入同权重, float32):
CPU-NPU consistency (same seed=42, same input, float32):
max_abs_diff 0.000627 mean 0.000317 median 0.000298
Consistency: PASS (max_diff < 0.01)
Sample CPU[0,0]: [0.5139882564544678, -0.8825832009315491, 0.1498299092054367, -1.0289244651794434, -0.8324450254440308, -0.18729375302791595, -0.8404298424720764, -0.5142483115196228]
Sample NPU[0,0]: [0.5144097805023193, -0.8820395469665527, 0.1496983915567398, -1.0286544561386108, -0.8320924639701843, -0.18682166934013367, -0.8403946161270142, -0.5141306519508362]
PASSnpu:0 执行, 误差远小于表格类 1e-2 阈值。python inference.py --mode benchmark (batch 1, seed 42, float32, npu:0, 3 warmup + 10 measured, torch.npu.synchronize):
Benchmark (batch 1, state [9] + 2x [3,480,640], float32, npu:0):
avg=24.03ms min=23.53ms max=25.08ms p50=23.76ms p90=24.59ms p95=24.83ms
throughput: 41.62 samples/s (149819.7 windows/h)
Peak HBM via npu-smi: idle ~3110 MB, with model ~3500 MB (<65536)assets/agent_workflow.png - 阶段日志: 下载、侦察、加载、NPU 推理、验证、性能assets/npu_device_call.png - npu-smi info + torch.npu 可用性/设备名/参数 device/dtype/输入输出 deviceassets/model_result.png - python inference.py 真实 NPU 输出与 PASS (xterm.js raw 渲染)所有图片由 xterm.js 根据本次真实日志生成, 非手工绘制, 固定提示符仅为展示标签。
MidoriChou/ai_final_12 完整轨迹回放; 真实机器人需接入 lerobot dataset 的真实图像与归一化统计。ResNet18_Weights.IMAGENET1K_V1 的在线下载, 设 pretrained_backbone_weights=None 后由 model.safetensors 覆盖全部权重, 与官方训练权重一致但初始化路径不同。temporal_ensemble_coeff (为 None) 与 use_vae 训练模式差异; 推理时 latent 取零向量 (ACT 推理默认)。trust_remote_code=False, 纯 lerobot + torch 实现, 无自定义 kernel, 未发生 CPU fallback。Hardware: NPU, #NPU, Ascend, Ascend910, robotics, act, lerobot, action-chunking, diffusion-policy-variant
