2301_76761127/ufm-base-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

UFM-Base Ascend NPU deployment

Official model: https://ai.gitcode.com/hf_mirrors/infinity1096/UFM-Base, fixed revision cb60fe3d33ace8bbe1416a1e93de0807336927c1.

Independent preparation

Run from an empty parent directory:

git clone https://gitcode.com/hf_mirrors/infinity1096/UFM-Base.git model
git -C model checkout --detach cb60fe3d33ace8bbe1416a1e93de0807336927c1
git -C model lfs pull
git clone --recurse-submodules https://github.com/infinity1096/UFM.git third_party/UFM
git -C third_party/UFM checkout --detach ff78d6c3db807c91578acccb58ee67d4394d5e5f
git -C third_party/UFM submodule update --init --recursive
git clone https://github.com/facebookresearch/dinov2.git third_party/dinov2-source
git -C third_party/dinov2-source checkout --detach 7764ea0f912e53c92e82eb78a2a1631e92725fc8
git clone https://gitcode.com/2301_78565107/UFM-Base.git repo
cd repo
python3 -m pip install --no-deps --target ../pydeps -r requirements.txt

NPU inference

source /usr/local/Ascend/cann-8.5.1/set_env.sh
export PYTHONNOUSERSITE=1
export PYTHONPATH="$(pwd)/../pydeps:$(pwd)/../third_party/UFM${PYTHONPATH:+:$PYTHONPATH}"
python3 inference.py --model_path ../model --dinov2_source ../third_party/dinov2-source \
  --device npu:0 --output_json result.json

The entry redirects the upstream DINOv2 request to the local source with pretrained=False; it never downloads at runtime. It strictly loads the checkpoint and refuses fallback. Model, inputs and outputs must remain on the selected NPU.

The Ascend path uses explicit float32 scaled-dot-product attention and exact-erf GELU for the transformer stack. Eight 56×56 image pairs produce flow, mask and mask-logit outputs, totaling 100,352 values. The result reports devices, NPU name, shapes, counts, finite values and exit status.

Verified platform: Ascend 910B3, Python 3.11, PyTorch with matching torch_npu, and CANN. The checkpoint card states a non-commercial Creative Commons license and UFM code is BSD-3-Clause; users must review both. Synthetic inputs validate NPU execution, not optical-flow benchmark quality.

本仓为 2301_76761127 队伍交付件(与备份账号合并提交)。