news 2026/5/9 11:21:47

CANN-VGGT昇腾推理

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
CANN-VGGT昇腾推理

VGGT inference on Ascend Atlas A2

【免费下载链接】cann-recipes-embodied-intelligence本项目针对具身智能业务中的典型模型、加速算法,提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-embodied-intelligence

CANN Environment Preparaton

  1. The inference of VGGT depends on the CANN development kit package (cann-toolkit) and the CANN binaray operator package(cann-kernels). The supported CANN software version is CANN 8.5.0.

    Download theAscend-cann-toolkit_${version}_linux-${arch}.runandAscend-cann-${chip_type}-ops_linux-${arch}.runpackages from the CANN Software Package Download Page and install them by referring to the CANN Installation Guide.

  2. The required versions of torch and torch_npu are 2.7.1 and 2.7.1.post2.

    Download the binary package from Ascend Extension for PyTorch and install torch and torch_npu.

    conda create -n vggt python==3.11.13 conda activate vggt pip3 install torch==2.7.1 pip3 install torch-npu==2.7.1.post2

VGGT Model Preparation

  1. Download the open-source VGGT network code from the github repo.
    git clone https://github.com/facebookresearch/vggt.git
  2. Download the code of this repository:
    git clone https://gitcode.com/cann/cann-recipes-embodied-intelligence.git
  3. Copy the code from the VGGT repository to this project directory in non-overwrite mode:
    cp -r vggt/examples cann-recipes-embodied-intelligence/3d_vision/vggt/ cp -rn vggt/vggt/dependency cann-recipes-embodied-intelligence/3d_vision/vggt/vggt/dependency cp -rn vggt/vggt/heads cann-recipes-embodied-intelligence/3d_vision/vggt/vggt/ cp -rn vggt/vggt/layers cann-recipes-embodied-intelligence/3d_vision/vggt/vggt/ cp -rn vggt/vggt/utils cann-recipes-embodied-intelligence/3d_vision/vggt/vggt/
  4. Install Python dependencies:
    pip3 install -r requirements.txt
  5. Download VGGT model weights and copy it to the local pathckpt.
    VGGT +--- examples +--- demo_infer.py +--- eval +--- ckpt +--- model.pt +--- quant +--- vggt +--- dependency +--- heads +--- layers +--- models +--- utils +--- sp

Performance Measurement

This repo provides script to test the functionality and the performance of VGGT model on NPU.

  1. Before executing the test scripts, refer to the Ascend Community CANN installation tutorial to set environment variables:

    source /usr/local/Ascend/ascend-toolkit/set_env.sh
  2. Run the inference script and the output presents the average inference time of vggt bf16 model.

    python demo_infer.py --ckpt "ckpt/model.pt"
  3. Run the inference script and the output presents the average inference time of vggt bf16_sp model.

    bash infer_test.sh

    Parameter description for multi NPU inference:

    torchrun --nproc_per_node=1 demo_infer.py \ --ckpt ${model_base} \ --images_path examples/kitchen/images \ --enable_sp \ --ulysses_degree 1 \ --ring_degree 1 # nproc_per_node:The torchrun parameter, the number of processes started by each node, needs to be equal to the number of NPU cards used; # ckpt:Model checkpoint file path; # images_path:Enter the directory where the image sequence is located; # enable_sp:Whether to enable sequence parallelism, default value: False, with the prerequisite that nproc_per_node>1; # ulysses_degree:Ulysses parallelism, constraint Ulysses_degree × ring_degree=nproc_per_node; Num_ attention heads must be divisible by Ulysses_degree; # ring_degree:Ring parallelism, constraint Ulysses_degree × ring_degree=nproc_per_node
  4. To perform vggt int8 model inference, you first need to build the vggt int8 model:

    python demo_infer.py --ckpt "ckpt/model.pt" --buildW8A8

    The vggt int8 model will be built in the current path, and then used for inference:

    python demo_infer.py --ckpt VGGT_model_W8A8.pt --enableW8A8

Accurancy Benchmark

This repo provides accurancy benchmark to evaluate the VGGT model on NPU. The full benchmark include three programs to test the accurancy of VGGT on Pose Evaluation, Point Map Evaluation and Depth Evaluation.

Since the full dataste of benchmark is large, we can initially test the accurancy of VGGT model in Pose Evaluation with the subset of the full Co3DV2 dataset.

Dataset Preparation:

  1. Download dataCO3D_apple.zipand dataCO3D_backpack.zipfrom CO3D website and unzip them todatasets/co3d/co3d_data/.
    VGGT +--- datasets +--- co3d +--- co3d_data +--- apple +--- backpack ...
  2. Prepare metadata of the dataset:
    export VGGT_DIR=$(pwd) cd eval/pose_evaluation/dataset_prepare python preprocess_co3d.py --category all --co3d_v2_dir $VGGT_DIR/datasets/co3d/co3d_data/ --output_dir $VGGT_DIR/datasets/co3d/co3d_anno/

Accurancy Measurement

  • Execute the benchmark program:

    • Use vggt bf16 model:
    export VGGT_DIR=$(pwd) cd eval/pose_evaluation python eval_co3d.py --co3d_dir $VGGT_DIR/datasets/co3d/co3d_data/ --co3d_anno_dir $VGGT_DIR/datasets/co3d/co3d_anno/ --ckpt $VGGT_DIR/ckpt/model.pt
    • Currently, the bf16 model measurement accurancy is about 0.911.
    • Use vggt int8 model:
    export VGGT_DIR=$(pwd) cd eval/pose_evaluation python eval_co3d.py --co3d_dir $VGGT_DIR/datasets/co3d/co3d_data/ --co3d_anno_dir $VGGT_DIR/datasets/co3d/co3d_anno/ --ckpt VGGT_model_W8A8.pt --enableW8A8
    • Currently, the int8 model measurement accurancy is about 0.907.

【免费下载链接】cann-recipes-embodied-intelligence本项目针对具身智能业务中的典型模型、加速算法,提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-embodied-intelligence

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/9 11:12:34

模型接力中转站:统一管理本地AI模型API的桌面工具

1. 项目概述:一个桌面端的模型接力中转站最近在折腾本地AI应用的时候,遇到一个挺普遍但有点烦人的问题:我手头有好几个不同框架、不同接口的模型,有的用OpenAI兼容的API,有的用HuggingFace的transformers,还…

作者头像 李华
网站建设 2026/5/9 11:07:31

RimSort:三步解决环世界MOD加载混乱的智能排序管理器

RimSort:三步解决环世界MOD加载混乱的智能排序管理器 【免费下载链接】RimSort RimSort is an open source mod manager for the video game RimWorld. There is support for Linux, Mac, and Windows, built from the ground up to be a reliable, community-manag…

作者头像 李华
网站建设 2026/5/9 11:06:31

Thread Notebook:AI深度集成的Jupyter替代品,本地与云端模型全解析

1. 项目概述:当Jupyter Notebook遇上AI副驾驶 如果你和我一样,日常工作中离不开Jupyter Notebook进行数据分析、模型探索或者教学演示,那你一定对那种在代码、文档和图表之间反复切换,同时还要打开另一个浏览器标签页去问AI“这段…

作者头像 李华
网站建设 2026/5/9 11:06:29

通过curl命令直接测试Taotoken大模型API连通性

🚀 告别海外账号与网络限制!稳定直连全球优质大模型,限时半价接入中。 👉 点击领取海量免费额度 通过curl命令直接测试Taotoken大模型API连通性 对于开发者而言,在集成大模型服务时,最直接、最底层的验证方…

作者头像 李华
网站建设 2026/5/9 11:05:30

基于agentforge框架构建多智能体系统:从原理到实践

1. 项目概述:一个面向未来的智能体构建框架最近在探索AI智能体开发时,发现了一个让我眼前一亮的开源项目——agentforge。这不仅仅是一个工具库,更像是一个为构建复杂、可协作的智能体系统而设计的“乐高积木”套装。在AI应用从单点工具向自主…

作者头像 李华