Instructions to use buildborderless/CommunityForensics-DeepfakeDet-ViT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use buildborderless/CommunityForensics-DeepfakeDet-ViT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="buildborderless/CommunityForensics-DeepfakeDet-ViT") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("buildborderless/CommunityForensics-DeepfakeDet-ViT") model = AutoModelForImageClassification.from_pretrained("buildborderless/CommunityForensics-DeepfakeDet-ViT", device_map="auto") - timm
How to use buildborderless/CommunityForensics-DeepfakeDet-ViT with timm:
import timm model = timm.create_model("hf_hub:buildborderless/CommunityForensics-DeepfakeDet-ViT", pretrained=True) - Inference
- Notebooks
- Google Colab
- Kaggle
fix(critical/BREAKING): correct config, regenerate weights, add ONNX v1.1, requires transformers >= 5.4.0
Summary
This PR fixes the model after discovering the safetensors weights, config, and preprocessor were all incorrect. The model had been serving 500K+ monthly downloads with silently wrong inference results.
Root cause
The original HF port was hastily created for an internal proof-of-concept. The model.safetensors was converted from different weights than the training checkpoint. The config.json had ViT-Base values (12 heads, intermediate_size=3072) instead of ViT-Small (6 heads, intermediate_size=1536). The preprocessor squashed non-square images.
What changed
Critical fixes
model.safetensors— regenerated from the authoritative training checkpointpretrained_weights/model_v11_ViT_384_base_ckpt.ptconfig.json—num_classes2→1,num_attention_heads12→6,intermediate_size3072→1536, removed redundant fieldspreprocessor_config.json—shortest_edge: 440+do_center_crop(preserves aspect ratio)
ONNX v1.1
- 5 new variants exported from corrected weights (84 MB FP32 down to 16 MB Q4)
- Previous 8 variants archived in
onnx_legacy/
Documentation
README.md— rewritten with fix notice, breaking change warning, ONNX variant guide, v2 teaserCHANGELOG.md— detailed change log of every commitAGENTS.md— created for LLM-based coding agents
Housekeeping
LICENSEadded with original MIT copyright + Borderless contributionsmodeling_vit_classifier.pymoved toscripts/and deprecatedmodel_legacy.safetensors+model_fixed.safetensorsarchived
Breaking change
transformers >= 5.4.0now required — older versions lackshortest_edgeresize and will crash
Verification
Corrected model output matches the original timm training pipeline within 0.004%.
Full changelog
See CHANGELOG.md for the complete commit-by-commit breakdown.
[reserved]