Skip to content
Other

TDV/anti-deepfake-dinov3-vit-pruned

структурированный прунинг DINOv3 для поиска дипфейков

2 min read

Репозиторий содержит артефакты физического структурированного прунинга (удаления несущественных весов и блоков) модели Meta DINOv3 ViT-S/16 Plus A1, предназначенной для криминалистического обнаружения дипфейков. Прунинг выполнен методом 1st-Order Taylor в диапазоне от 5% до 90% с сохранением размерности и архитектуры слоев. Набор включает модели разной степени сжатия, оптимизированные для эффективного запуска на потребительских и серверных GPU. Решение подойдет разработчикам систем безопасности и исследователям мультимедиа для быстрой проверки изображений на подделку.

Ключевые особенности

  • 12 вариантов прунинга: от легкого сжатия на 5% до экстремального удаления 90% весов.
  • Сохранение точности: модель prune_taylor_20pct показывает потерю точности в пределах погрешности при уменьшении параметров на 20%.
  • Готовые веса и конфигурации: чистые inference-форматы с сохраненными порогами классификации и архитектурными конфигами.
  • Высокая скорость работы: ускорение обработки батчей на RTX 4060 и L4 по сравнению с базовой версией.

Что можно сделать

  • Интегрировать в пайплайн проверки: встроить модель в сервис верификации изображений для автоматического обнаружения дипфейков.
  • Протестировать разную степень сжатия: выбрать подходящую модель из линейки под жесткие ограничения по VRAM и требованиям к скорости.
  • Запустить инференс на Python: загрузить веса напрямую из репозитория с помощью готового скрипта и оценить вероятность подделки.

Пример

import torch
from huggingface_hub import hf_hub_download

hf_hub_download("TDV/anti-deepfake-dinov3-vit-pruned", "dinov3_vit.py", local_dir=".")
hf_hub_download("TDV/anti-deepfake-dinov3-vit-pruned", "load_model.py", local_dir=".")

from load_model import load_from_hf

model, meta = load_from_hf("prune_taylor_20pct", repo_id="TDV/anti-deepfake-dinov3-vit-pruned", device="cuda")
tau_youden = meta.get("val_threshold_youden", 0.5)

x = torch.randn(1, 3, 256, 256, device="cuda")
with torch.no_grad():
    probs = torch.softmax(model(x), dim=-1)
    p_fake = probs[:, 1].item()
    pred = "FAKE" if p_fake >= tau_youden else "REAL"
ПодробнееБазовая модель: Meta DINOv3 ViT-S/16 Plus A1 (28.69M параметров).
Лучшая lossless-модель (Tier 1): prune_taylor_20pct (сжатие 20.04%, размер FP16: 43.83 МБ, RTX 4060: 736.6 FPS, Val Acc: 98.58%).
Сбалансированная модель (Tier 2): prune_taylor_40pct (сжатие 39.97%, размер FP16: 32.93 МБ, RTX 4060: 891.3 FPS, Val Acc: 97.38%).
Ограничения: требуется PyTorch и CUDA-совместимая видеокарта для эффективного инференса.
Примеры
Discuss TelegramReport 0

Will it run?

Runs in BF16

Fits without quantisation.

  • BF16weights 0.1 GB · ready files0.6 GB
  • FP8 / INT8recommendedweights 0.1 GB0.6 GB
  • 4-bitweights 0.0 GB0.5 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

What to get for this model

Massed ComputeOpen Massed Compute

Your own GPU: FP8 / INT8 — from RTX 2060 · BF16 — from RTX 2060

Massed Compute hourly prices, November 2026. The discounted price applies with the coupon at checkout.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # TDV/anti-deepfake-dinov3-vit-pruned
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download TDV/anti-deepfake-dinov3-vit-pruned --local-dir ~/models/anti-deepfake-dinov3-vit-pruned
    # The model is in ~/models. How to run it is in the model card (link above).
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b42from December 2, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

New posts about versions of anti-deepfake-dinov3-vit-pruned (quants, finetunes, LoRAs) will show up under the bell.

No known relatives of this model yet. All derivatives on Hugging Face

About the model

TDV/anti-deepfake-dinov3-vit-pruned
Author
TDV
Category
Other
Released
Posted

On NeyroLearn

Hugging Face

00

Ask AI about this model

Generated by external AI (Google Gemini) · chat stays only in this tab · Privacy Policy

Comments