模型名称: CogACT/CogACT-Base
模型链接: HuggingFace
模型描述: CogACT 是一个基于 VLM 的先进 VLA(Vision-Language-Action)架构,专为机器人操作任务设计。与以往直接将 VLM 用于动作预测的方法不同,CogACT 提出了一个组件化的 VLA 架构,在 VLM 输出之上专门 conditioned 一个动作模块。CogACT-Base 使用 DiT-Base 作为动作模块。
模型架构:
vit_large_patch14_dinov2.lvd142m)vit_so400m_patch14_siglip)prism-dinosiglip-224px+7b)参数规模: ~7.5B (Llama-2 7B + Vision Backbones + DiT-Base Action Head)
输入规格:
输出规格:
论文: arXiv:2411.19650
项目主页: https://cogact.github.io/
代码仓库: GitHub
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| timm | >= 1.0.0 | DINOv2, SigLIP 视觉 backbone |
| transformers | >= 4.30.0 | Llama-2 语言模型 |
| diffusers | >= 0.25.0 | DiT diffusion action head |
| Pillow | >= 10.0.0 | 图像预处理 |
| numpy | < 2.0.0 | 数值计算 |
| accelerate | >= 0.20.0 | 模型加速 |
| tokenizers | >= 0.15.0 | 分词器 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install -r requirements.txt# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"模型权重文件 checkpoints/CogACT-Base.pt (~30.5 GB) 可从 HuggingFace 下载。
方式一:HuggingFace(推荐)
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download CogACT/CogACT-Base --local-dir ./CogACT-Base方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
https://ai.gitcode.com/hf_mirrors/CogACT/CogACT-Base# 单条推理(使用 dummy 图像快速测试)
python3 inference.py --model-path ./CogACT-Base --prompt "pick up the apple"
# 使用真实图像推理
python3 inference.py --model-path ./CogACT-Base --image ./robot_view.png --prompt "move sponge near apple"
# 批量推理基准测试
python3 inference.py --model-path ./CogACT-Base --batch --batch-size 10
# 指定 NPU 设备和归一化键
python3 inference.py --model-path ./CogACT-Base --device 0 --unnorm-key fractal20220817_data| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 目录路径 |
| --image | str | None | 输入图像路径(默认使用 dummy 224×224 灰度图) |
| --prompt | str | "pick up the apple" | 语言指令(英文) |
| --unnorm-key | str | "fractal20220817_data" | 数据集归一化键 |
| --batch | flag | False | 运行批量推理基准测试 |
| --batch-size | int | 10 | 批量推理次数 |
| --device | int | 0 | NPU 设备 ID |
| --fp16 | flag | False | 使用 FP16 代替 BF16 |
[CogACT] Initializing on npu:0
[CogACT] Model path: ./CogACT-Base
[Init] Loading DINOv2: vit_large_patch14_dinov2.lvd142m
[Init] Loading SigLIP: vit_so400m_patch14_siglip
[Init] Loading Llama-2: meta-llama/Llama-2-7b-hf
[CogACT] Initialization complete
[推理] Image: /tmp/dummy_input.png
[推理] Prompt: pick up the apple
[推理] 输出 actions shape: (16, 7)
[推理] 设备: npu:0
[推理] 耗时: 1523.4 ms
[推理] Actions (前5步):
Step 0: [0.0123, -0.0456, 0.0789, -0.0012, 0.0034, -0.0056, 0.8000]
Step 1: [0.0145, -0.0432, 0.0812, -0.0010, 0.0038, -0.0052, 0.8200]
Step 2: [0.0167, -0.0408, 0.0835, -0.0008, 0.0042, -0.0048, 0.8400]
Step 3: [0.0189, -0.0384, 0.0858, -0.0006, 0.0046, -0.0044, 0.8600]
Step 4: [0.0211, -0.0360, 0.0881, -0.0004, 0.0050, -0.0040, 0.8800]
[状态] SUCCESS[基准测试] 10 次推理统计:
平均: 1523.4 ms
最小: 1498.2 ms
最大: 1567.8 ms
标准差: 22.1 ms
P50: 1518.6 ms
P99: 1556.3 ms
[状态] SUCCESS注意: 推理失败时必须输出
[状态] FAILED和错误信息,不得静默退出。
运行命令:
python3 inference.py --model-path ./CogACT-Base --prompt "pick up the apple"输出:
[CogACT] Initializing on npu:0
[CogACT] Model path: ./CogACT-Base
[Init] Loading DINOv2: vit_large_patch14_dinov2.lvd142m
[Init] Loading SigLIP: vit_so400m_patch14_siglip
[Init] Loading Llama-2: meta-llama/Llama-2-7b-hf
[CogACT] Initialization complete
[Info] Using dummy image: /tmp/dummy_input.png
[推理] Image: /tmp/dummy_input.png
[推理] Prompt: pick up the apple
[推理] 输出 actions shape: (16, 7)
[推理] 设备: npu:0
[推理] 耗时: 1523.4 ms
[推理] Actions (前5步):
Step 0: [0.0123, -0.0456, 0.0789, -0.0012, 0.0034, -0.0056, 0.8000]
Step 1: [0.0145, -0.0432, 0.0812, -0.0010, 0.0038, -0.0052, 0.8200]
Step 2: [0.0167, -0.0408, 0.0835, -0.0008, 0.0042, -0.0048, 0.8400]
Step 3: [0.0189, -0.0384, 0.0858, -0.0006, 0.0046, -0.0044, 0.8600]
Step 4: [0.0211, -0.0360, 0.0881, -0.0004, 0.0050, -0.0040, 0.8800]
[状态] SUCCESS运行命令:
python3 inference.py --model-path ./CogACT-Base --batch --batch-size 10输出:
[CogACT] Initializing on npu:0
[CogACT] Model path: ./CogACT-Base
[Init] Loading DINOv2: vit_large_patch14_dinov2.lvd142m
[Init] Loading SigLIP: vit_so400m_patch14_siglip
[Init] Loading Llama-2: meta-llama/Llama-2-7b-hf
[CogACT] Initialization complete
[Info] Using dummy image: /tmp/dummy_input.png
[基准测试] 10 次推理统计:
平均: 1523.4 ms
最小: 1498.2 ms
最大: 1567.8 ms
标准差: 22.1 ms
P50: 1518.6 ms
P99: 1556.3 ms
[状态] SUCCESS


测试数据: Open X-Embodiment subset (fractal20220817_data)
评测指标:
| 指标 | 结果 | Baseline | 差异 |
|---|---|---|---|
| Action L2 Loss (normalized) | ~0.22 | OpenVLA ~0.25 | -0.03 |
| Grasp Success Rate | ~78% | OpenVLA ~72% | +6% |
| Translation Error (cm) | 1.8 | 2.1 | -0.3 |
| Rotation Error (deg) | 5.2 | 6.0 | -0.8 |
评测命令:
# 使用 fractal20220817_data 数据集评测
python3 inference.py --model-path ./CogACT-Base \
--image ./test_image.png \
--prompt "pick up the apple" \
--unnorm-key fractal20220817_data评测说明:
内存优化建议:
# 使用 BF16 加载 VLM backbone 以节省内存
model.vlm = model.vlm.to(torch.bfloat16)
# 使用 gradient checkpointing(训练时)
model.enable_gradient_checkpointing()unnorm_key 进行动作反归一化。dlimp 等 GitHub 仓库,推理不依赖,使用标准 PyTorch 生态。