SAVRN
Search Contact SAVRN

Open-weight model · Image classification

vit-base-nsfw-detector

by AdamCodd AdamCodd/vit-base-nsfw-detector

This model is a fine-tuned version of vit-base-patch16-384 on around 25000 images (drawings, photos...).

Parameters86M
Context
Weights1.3 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads960.4k

Runs On

What it takes to serve vit-base-nsfw-detector (86M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.2 GB 0.2 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

SAVRN's Notes on vit-base-nsfw-detector

Screening uploads before they hit a feed or a training set is the job here, and at 86 million parameters it barely registers on a GPU. The 16-bit weights take 0.2 GB and the run needs 0.2 GB of memory, so the cheapest slot in our table, one MI300X with 192 GB at $1.85 an hour on demand, is far more card than the model needs. Park it beside a larger model rather than give it a card of its own. It ships as safetensors and ONNX and targets transformers.js, so a browser deployment is possible.

Apache 2.0 allows commercial use, modification and redistribution provided the notices travel with it. The publisher fine-tuned google/vit-base-patch16-384 on about 25,000 drawings and photos with no generated images, and says it does worse on generated content, pointing to a separate model, AdamCodd/vit-nsfw-stable-diffusion, for that. And the last update was December 2024, so pin the checkpoint you tested.

Model Card

By AdamCodd, published under apache-2.0, revision 8587de998f44.

This model is a fine-tuned version of vit-base-patch16-384 on around 25_000 images (drawings, photos...). It achieves the following results on the evaluation set: - Loss: 0.0937 - Accuracy: 0.9654

New [07/30]: I created a new ViT model specifically to detect NSFW/SFW images for stable diffusion usage (read the disclaimer below for the reason): AdamCodd/vit-nsfw-stable-diffusion.

Disclaimer: This model wasn't made with generative images in mind! There is no generated image in the dataset used here, and it performs significantly worse on generative images, which will require another ViT model specifically trained on generative images. Here are the model's actual scores for generative images to give you an idea: - Loss: 0.3682 (↑ 292.95%) - Accuracy: 0.8600 (↓ 10.91%) - F1: 0.8654 - AUC: 0.9376 (↓ 5.75%) - Precision: 0.8350 - Recall: 0.8980

Model description

Read the full model card (681 words)

Configuration

Architecture
ViTForImageClassification
Layers
12
Hidden size
768
Feed-forward size
3,072
Attention heads
12
Stored precision
float32
Model type
vit

Identity and Version

Repository
AdamCodd/vit-base-nsfw-detector
Publisher
AdamCodd
Task
Image classification
Modality
Image
Library
transformers.js
Parameters
86M parameters
Languages
nlp, vit
Revision
8587de998f441aac03fdd57a85d2e4cb808c7d64
First published
2024-01-03
Last updated
2024-12-03

Files and Weights

16 files, 1.3 GB in total. The weights are 9 files totalling 1.3 GB in onnx, safetensors.

Weights9 files · 1.3 GB
Configuration4 files · 2.0 KB
Documentation1 file · 6.0 KB
Other1 file · 39.2 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights344.4 MB 266efb8bf67c
onnx/model.onnxWeights344.6 MB dce8f5af8509
onnx/model_bnb4.onnxWeights52.6 MB 5a5e12ed3400
onnx/model_fp16.onnxWeights172.4 MB e9693884a06a
onnx/model_int8.onnxWeights88.5 MB d25aa73fe1ee
onnx/model_q4.onnxWeights57.9 MB a76b59a27ffa
onnx/model_q4f16.onnxWeights50.3 MB 8402aaf2e181
onnx/model_quantized.onnxWeights88.5 MB 432763a6899e
onnx/model_uint8.onnxWeights88.5 MB 432763a6899e
config.jsonConfiguration715 B
onnx/config.jsonConfiguration691 B
onnx/preprocessor_config.jsonConfiguration327 B
preprocessor_config.jsonConfiguration232 B
README.mdDocumentation6.0 KB
confusion_matrix.pngOther39.2 KB
.gitattributesRepository1.5 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
1.3 GB
Download from AdamCodd

Released by AdamCodd through its official repository on Hugging Face. Read the license.

Built From

  • Derived from google/vit-base-patch16-384
  • Quantized from google/vit-base-patch16-384

Memory Requirements

PrecisionWeights in memory
As published1.3 GB
16-bit0.2 GB
8-bit0.1 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Compare vit-base-nsfw-detector

Questions About vit-base-nsfw-detector

How much GPU memory does vit-base-nsfw-detector need?

About 0.2 GB at 16-bit and 0.1 GB at 4-bit: the weights (86M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run vit-base-nsfw-detector on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use vit-base-nsfw-detector commercially?

Yes. vit-base-nsfw-detector is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

Similar Models

Model · Image classification

nsfw_image_detector

Freepik

This model is a vision transformer based on the EVA architecture, fine-tuned for NSFW content classification. It has been trained to detect four categories (neutral, low, medium, high) of visual content using 100,000 synthetically labeled images. The model can be used as a binary (true/false) classifier if desired, or you can obtain the full output probabilities.. It outperforms other excellent publicly available models such as Falconsai/nsfwimagedetection or AdamCodd/vit-base-nsfw-detector in our internal benchmarks adding the enrichment of being able to select the NSFW level that suits your use case. You can try this model directly in your browser through our Hugging Face Space. Upload…

Open weights mit 86M parameters transformers

Model · Image classification

vit-base-oxford-iiit-pets

Ilias Strub

This model is a fine-tuned version of google/vit-base-patch16-224 on the pcuenq/oxford-pets dataset. It achieves the following results on the evaluation set: This model is a fine-tuned version of a pre-trained Vision Transformer (google/vit-base-patch16-224) for image classification on the Oxford-IIIT Pet Dataset. It uses transfer learning to adapt a generic vision model to identify 37 different cat and dog breeds. The model head is adjusted to output the number of classes in the dataset, and it is trained end-to-end using standard classification loss. - Educational demos on transfer learning and fine-tuning vision models. - Pet breed classification in structured datasets similar to Oxford…

Open weights apache-2.0 86M parameters transformers

Model · Image classification

nsfw-classifier

Giacomo Arienti

In today's digital world, user-generated content is a double-edged sword. While it fosters creativity and engagement, it also opens the door to inappropriate or illegal content being shared. Our NSFW Image Classifier is specifically designed to identify and filter out explicit images, including pornography, hentai, and sexually suggestive content, ensuring your platform remains safe, secure, and legally compliant. With more than 2M downloads, our NSFW Image Classifier has become the go-to solution for platforms looking to maintain a clean and safe environment for their users. Many developers and companies have already chosen our solution to protect their communities—will you be next? 1.…

Open weights cc-by-nc-nd-4.0 86M parameters transformers

Model · Image classification

nsfw_image_detection

Falcons.ai

The Fine-Tuned Vision Transformer (ViT) is a variant of the transformer encoder architecture, similar to BERT, that has been adapted for image classification tasks. This specific model, named "google/vit-base-patch16-224-in21k," is pre-trained on a substantial collection of images in a supervised manner, leveraging the ImageNet-21k dataset. The images in the pre-training dataset are resized to a resolution of 224x224 pixels, making it suitable for a wide range of image recognition tasks. During the training phase, meticulous attention was given to hyperparameter settings to ensure optimal model performance. The model was fine-tuned with a judiciously chosen batch size of 16. This choice not…

Open weights apache-2.0 86M parameters transformers