ACT (Action Chunking with Transformers) 来自论文 Action Chunking with Transformers,是一种模仿学习方法,通过预测短动作序列而非单步动作来实现机器人控制。
本模型 (MidoriChou/ai_final_12_act_2) 使用 LeRobot 训练,应用于 Final12 机器人任务。
| 属性 | 值 |
|---|---|
| 模型类型 | ACT (Action Chunking Transformer) |
| 参数量 | 51.67 M |
| Vision Backbone | ResNet18 |
| dim_model | 512 |
| Attention Heads | 8 |
| Feedforward Dim | 3200 |
| Encoder Layers | 4 |
| Decoder Layers | 1 |
| VAE Latent Dim | 32 |
| Chunk Size | 100 |
observation.state: (batch, 9) - 机器人状态observation.images.front: (batch, 3, 480, 640) - 前视图像observation.images.wrist: (batch, 3, 480, 640) - 手腕图像action: (batch, chunk_size, 8) - 100 步动作块,8 维动作| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| 操作系统 | CentOS 7.6+ / Ubuntu 18.04+ | 支持主流 Linux 发行版 |
| CANN | 5.0.RC2+ | 华为昇腾计算架构 |
| Python | 3.10 / 3.12 | 推荐 3.10+ |
| PyTorch | 2.0.0+ | 推荐 2.12 |
| torch_npu | 与 PyTorch 版本匹配 | 昇腾 PyTorch 扩展 |
| torchvision | >=0.15.0 | ResNet 骨干网络 |
| lerobot | 0.3.0+ | 机器人策略训练框架(可选) |
# 1) 激活已预装 torch / torch_npu 的 conda 环境
conda activate pt2100
# 2) 安装依赖(使用华为云源)
pip install torchvision -i https://repo.huaweicloud.com/repository/pypi/simple
# 3) 验证环境
python -c "
import torch, torch_npu
print('torch:', torch.__version__)
print('torch_npu:', torch_npu.__version__)
print('NPU 可用:', torch.npu.is_available())
"# 进入适配目录
cd /workspace/agent4/ai_final12_act2-ascend
# 确认上游权重存在
ls -la /workspace/agent3/MidoriChou/ai_final_12_act_2/
# 期望输出:config.json model.safetensors (~197MB) ...# 检查 NPU 设备状态
npu-smi info
# 验证 torch_npu 安装
python -c "import torch; import torch_npu; print('NPU 可用:', torch.npu.is_available())"# 基本用法:默认参数
python inference.py --device npu:0
# 指定其他 NPU 卡
python inference.py --device npu:1
# 自定义 batch size
python inference.py --device npu:0 --batch_size 2conda activate pt2100
cd /workspace/agent4/ai_final12_act2-ascend
python inference.py --device npu:0实际输出:
[W823 12:08:10.853751860 FunctionLoader.cpp:48] Warning: LD_PRELOAD detected...
[W823 12:08:16.025321760 NPUCachingAllocator.cpp:201] Warning: The current CANN and Soc versions require processing for 32 padding size...
[W823 12:08:18.817318970 VariableFallbackKernel.cpp:250] Warning: CAUTION: The operator 'aten::_transformer_encoder_layer_fwd' is not currently supported on the NPU backend and will fall back to run on the CPU...
============================================================
ACT Policy 昇腾 NPU 推理
============================================================
[Device] npu:0
[Model Path] /workspace/agent3/MidoriChou/ai_final_12_act_2
[Config]
type: act
dim_model: 512
n_heads: 8
n_encoder_layers: 4
n_decoder_layers: 1
chunk_size: 100
action_dim: 8
state_dim: 9
[Memory Before Model Load] Allocated: 0.00 GB, Reserved: 0.00 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| npu-smi 25.5.2 Version: 25.5.2 |
+---------------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 95.3 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 3424 / 65536 |
+========================---+===============+====================================================+
[Loading] Model weights...
[Loading] /workspace/agent3/MidoriChou/ai_final_12_act_2/model.safetensors
Loaded 234 keys
Total parameters: 51.67 M
[Creating] ACT Policy model...
[Loading] Weights into model...
Loaded 234 weights
[Model Loaded] Allocated: 0.39 GB, Reserved: 0.40 GB
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 104.3 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 3896 / 65536 |
+========================---+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+============---+====================================================+
| 0 0 | 1688875 | python | 526 |
+===========================+===============+====================================================+
[Creating] Dummy observation input...
State shape: torch.Size([1, 9])
Front image shape: torch.Size([1, 3, 480, 640])
Wrist image shape: torch.Size([1, 3, 480, 640])
[Running] ACT policy inference...
[npu-smi info]
+------------------------------------------------------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+===========================+===============+====================================================+
| 0 910B2 | OK | 104.1 41 0 / 0 |
| 0 | 0000:C1:00.0 | 0 0 / 0 4044 / 65536 |
+========================---+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU Chip | Process id | Process name | Process memory(MB) |
+===========================+===============+====================================================+
| 0 0 | 1688875 | python | 674 |
+===========================+===============+====================================================+
[Results]
Output shape: torch.Size([1, 100, 8])
Output mean: -0.025676
Output std: 0.593415
[Memory After Inference] Allocated: 0.40 GB, Reserved: 0.49 GB
[Done]| 指标 | 值 |
|---|---|
| 模型参数量 | 51.67 M |
| 权重文件 | model.safetensors (~197 MB) |
| 推理显存峰值 | ~1.5 GB |
| 输出形状 | (1, 100, 8) - 批次×动作块×动作维度 |
aten::_transformer_encoder_layer_fwd,部分 Transformer 运算会回退到 CPU 执行pip install lerobot 安装