在昇腾Atlas A2环境上适配VGGT模型的推理【免费下载链接】cann-recipes-spatial-intelligence本项目针对空间智能业务中的典型模型、加速算法提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-spatial-intelligence本样例基于VGGT开源模型查看。此外本样例基于VGGT模型在NPU进行了性能优化目前VGGT模型在25张图片输入下推理时间下降至1.12秒。详细内容可至性能优化章节查看。执行样例CANN环境准备本样例的执行依赖CANN开发套件包cann-toolkit与CANN二进制算子包cann-kernels目前使用CANN软件版本为CANN.8.5.0。 请从CANN软件包下载地址下载Ascend-cann-toolkit_${version}_linux-${arch}.run与Ascend-cann-${chip_type}-ops_linux-${arch}.run软件包并参考CANN安装文档进行安装。本样例依赖的torch以及torch_npu版本为2.7.1。 请从Ascend Extension for PyTorch插件下载torch与torch_npu安装包本样例依赖的torch与torch_npu版本分别为2.7.1和2.7.1.post2。conda create -n vggt python3.11.13 conda activate vggt pip3 install torch2.7.1 pip3 install torch_npu2.7.1.post2网络模型代码准备本仓库依赖VGGT的开源仓库代码。进入VGGT的官方仓库下载VGGT模型网络结构代码git clone https://github.com/facebookresearch/vggt.git下载本仓库代码git clone https://gitcode.com/cann/cann-recipes-spatial-intelligence.git将VGGT仓库的网络模型文件以非覆盖模式复制到本项目目录下。cp vggt/visual_utils.py cann-recipes-spatial-intelligence/models/vggt/ cp -r vggt/examples cann-recipes-spatial-intelligence/models/vggt/ cp -rn vggt/vggt/dependency cann-recipes-spatial-intelligence/models/vggt/vggt/dependency cp -rn vggt/vggt/heads cann-recipes-spatial-intelligence/models/vggt/vggt/ cp -rn vggt/vggt/layers cann-recipes-spatial-intelligence/models/vggt/vggt/ cp -rn vggt/vggt/utils cann-recipes-spatial-intelligence/models/vggt/vggt/安装Python依赖cd cann-recipes-spatial-intelligence/models/vggt/ pip3 install -r requirements.txtVGGT 模型权重下载VGGT model checkpoint并将权重文件model.pt复制到ckpt目录下。模型权重与模型结构在文件目录中罗列如下VGGT --- examples --- demo_infer.py --- eval --- ckpt --- model.pt --- quant --- vggt --- dependency --- heads --- layers --- models --- utils --- sp快速启动本样例准备了单卡和多卡环境下的推理样例脚本。 执行脚本前请参考Ascend社区中的CANN安装软件教程配置环境变量source /usr/local/Ascend/ascend-toolkit/set_env.sh推理bf16模型脚本单卡运行python demo_infer.py --ckpt ckpt/model.pt推理bf16模型脚本多卡运行bash infer_test.sh多卡推理的参数说明torchrun --nproc_per_node1 demo_infer.py \ --ckpt ${model_base} \ --images_path examples/kitchen/images \ --enable_sp \ --ulysses_degree 1 \ --ring_degree 1--nproc_per_nodetorchrun参数每个节点启动的进程数需要等于使用的NPU卡数--ckpt模型checkpoint文件路径--images_path输入图像序列所在目录--enable_sp:是否启用序列并行,默认值: False,前提条件为nproc_per_node 1--ulysses_degreeUlysses并行度,约束ulysses_degree × ring_degree nproc_per_nodenum_attention_heads 必须能被 ulysses_degree 整除--ring_degreeRing并行度,约束ulysses_degree × ring_degree nproc_per_node推理int8模型需要先生成int8模型(当前实现中只将VGGT模型中K4096的Linear层进行了8bit量化)python demo_infer.py --ckpt ckpt/model.pt --buildW8A8in8模型会生成在当前路径再使用该int8模型进行推理python demo_infer.py --ckpt VGGT_model_W8A8.pt --enableW8A8Citationinproceedings{wang2025vggt, title{VGGT: Visual Geometry Grounded Transformer}, author{Wang, Jianyuan and Chen, Minghao and Karaev, Nikita and Vedaldi, Andrea and Rupprecht, Christian and Novotny, David}, booktitle{Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, year{2025} }【免费下载链接】cann-recipes-spatial-intelligence本项目针对空间智能业务中的典型模型、加速算法提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-spatial-intelligence创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
CANN / cann-recipes-spatial-intelligence: 在昇腾Atlas A2环境上适配VGGT模型的推理
发布时间:2026/7/17 19:24:53
在昇腾Atlas A2环境上适配VGGT模型的推理【免费下载链接】cann-recipes-spatial-intelligence本项目针对空间智能业务中的典型模型、加速算法提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-spatial-intelligence本样例基于VGGT开源模型查看。此外本样例基于VGGT模型在NPU进行了性能优化目前VGGT模型在25张图片输入下推理时间下降至1.12秒。详细内容可至性能优化章节查看。执行样例CANN环境准备本样例的执行依赖CANN开发套件包cann-toolkit与CANN二进制算子包cann-kernels目前使用CANN软件版本为CANN.8.5.0。 请从CANN软件包下载地址下载Ascend-cann-toolkit_${version}_linux-${arch}.run与Ascend-cann-${chip_type}-ops_linux-${arch}.run软件包并参考CANN安装文档进行安装。本样例依赖的torch以及torch_npu版本为2.7.1。 请从Ascend Extension for PyTorch插件下载torch与torch_npu安装包本样例依赖的torch与torch_npu版本分别为2.7.1和2.7.1.post2。conda create -n vggt python3.11.13 conda activate vggt pip3 install torch2.7.1 pip3 install torch_npu2.7.1.post2网络模型代码准备本仓库依赖VGGT的开源仓库代码。进入VGGT的官方仓库下载VGGT模型网络结构代码git clone https://github.com/facebookresearch/vggt.git下载本仓库代码git clone https://gitcode.com/cann/cann-recipes-spatial-intelligence.git将VGGT仓库的网络模型文件以非覆盖模式复制到本项目目录下。cp vggt/visual_utils.py cann-recipes-spatial-intelligence/models/vggt/ cp -r vggt/examples cann-recipes-spatial-intelligence/models/vggt/ cp -rn vggt/vggt/dependency cann-recipes-spatial-intelligence/models/vggt/vggt/dependency cp -rn vggt/vggt/heads cann-recipes-spatial-intelligence/models/vggt/vggt/ cp -rn vggt/vggt/layers cann-recipes-spatial-intelligence/models/vggt/vggt/ cp -rn vggt/vggt/utils cann-recipes-spatial-intelligence/models/vggt/vggt/安装Python依赖cd cann-recipes-spatial-intelligence/models/vggt/ pip3 install -r requirements.txtVGGT 模型权重下载VGGT model checkpoint并将权重文件model.pt复制到ckpt目录下。模型权重与模型结构在文件目录中罗列如下VGGT --- examples --- demo_infer.py --- eval --- ckpt --- model.pt --- quant --- vggt --- dependency --- heads --- layers --- models --- utils --- sp快速启动本样例准备了单卡和多卡环境下的推理样例脚本。 执行脚本前请参考Ascend社区中的CANN安装软件教程配置环境变量source /usr/local/Ascend/ascend-toolkit/set_env.sh推理bf16模型脚本单卡运行python demo_infer.py --ckpt ckpt/model.pt推理bf16模型脚本多卡运行bash infer_test.sh多卡推理的参数说明torchrun --nproc_per_node1 demo_infer.py \ --ckpt ${model_base} \ --images_path examples/kitchen/images \ --enable_sp \ --ulysses_degree 1 \ --ring_degree 1--nproc_per_nodetorchrun参数每个节点启动的进程数需要等于使用的NPU卡数--ckpt模型checkpoint文件路径--images_path输入图像序列所在目录--enable_sp:是否启用序列并行,默认值: False,前提条件为nproc_per_node 1--ulysses_degreeUlysses并行度,约束ulysses_degree × ring_degree nproc_per_nodenum_attention_heads 必须能被 ulysses_degree 整除--ring_degreeRing并行度,约束ulysses_degree × ring_degree nproc_per_node推理int8模型需要先生成int8模型(当前实现中只将VGGT模型中K4096的Linear层进行了8bit量化)python demo_infer.py --ckpt ckpt/model.pt --buildW8A8in8模型会生成在当前路径再使用该int8模型进行推理python demo_infer.py --ckpt VGGT_model_W8A8.pt --enableW8A8Citationinproceedings{wang2025vggt, title{VGGT: Visual Geometry Grounded Transformer}, author{Wang, Jianyuan and Chen, Minghao and Karaev, Nikita and Vedaldi, Andrea and Rupprecht, Christian and Novotny, David}, booktitle{Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, year{2025} }【免费下载链接】cann-recipes-spatial-intelligence本项目针对空间智能业务中的典型模型、加速算法提供基于CANN平台的优化样例项目地址: https://gitcode.com/cann/cann-recipes-spatial-intelligence创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考