gcw_6a3w2yXz/momentslab-peek-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

momentslab/peek on Ascend NPU #NPU

  1. Model Overview

    PEEK (Picking Essential frames via Efficient Knowledge distillation) is a query-free video frame selector for low-budget video captioning. It receives video frame embeddings and predicts per-frame relevance scores, returning the most important frames in temporal order for downstream Video-Language Models.

    • Architecture: PeekScorer - 2-layer Transformer (~1.7M parameters)
    • Encoder: MobileCLIP2-S0 (frozen, 512-dim features)
    • Teacher: SigLIP2 SO400M patch14 384 (frozen, for training only)
    • Selection Policy: Stratified argmax across temporal buckets
    • License: CC-BY-NC-SA-4.0
  2. Validation Environment

    ComponentVersion
    OSLinux (aarch64)
    Python3.11.14
    PyTorch2.9.0+cpu
    torch_npu2.9.0.post1
    CANN8.5.1
    NPUAscend 910B (Ascend910_9362)
    NPU Count2
  3. Installation

    pip install torch>=2.0 torch-npu numpy safetensors open_clip_torch Pillow
  4. NPU Inference

    python inference.py --model-dir /path/to/model_dir --k 4 --num-frames 20 --device npu:0

    The script automatically:

    • Checks NPU environment availability
    • Loads PeekScorer weights from local checkpoint
    • Encodes test frames with MobileCLIP2 encoder
    • Scores frames and selects top-k via stratified_argmax
    • Reports timing and device information
  5. Real Inference Results

    Test configuration: 20 synthetic frames, k=4 selection, Ascend 910B NPU

    NPU Results:
      Frame   4 (t=2.0s): score=-0.5395
      Frame   5 (t=2.5s): score=-0.4766
      Frame  10 (t=5.0s): score=-0.5911
      Frame  15 (t=7.5s): score=-0.6969
    
    Performance:
      Encode time: 0.095s
      Score time: 0.016s
      Total inference time: 0.112s
  6. CPU-NPU Consistency Verification

    MetricCPUNPUStatus
    Selected frames[4, 5, 10, 15][4, 5, 10, 15]MATCH
    Frame 4 score-0.5379-0.5395~0.3% diff
    Frame 5 score-0.4754-0.4766~0.3% diff
    Frame 10 score-0.5880-0.5911~0.5% diff
    Frame 15 score-0.6956-0.6969~0.2% diff

    Both CPU and NPU produce identical frame selections with negligible score differences (< 0.5%), confirming numerical consistency.

  7. Performance Test

    MetricValue
    Model parameters1,712,129
    Frame encoding (20 frames)0.095s
    Frame scoring0.016s
    Total inference0.112s
    DeviceAscend 910B (npu:0)
  8. Known Limitations

    • MobileCLIP2 encoder uses random weights in this adaptation (pretrained weights require internet access to HuggingFace/timm)
    • The aten::_transformer_encoder_layer_fwd operator falls back to CPU on NPU backend
    • For production use, download MobileCLIP2-S0 pretrained weights from timm/MobileCLIP2-S0-OpenCLIP
    • This is a frame selection model, not an ASR model; no audio input is required