Image Classification
Transformers
Safetensors
PyTorch
vit
Not-For-All-Audiences
Eval Results (legacy)
Instructions to use giacomoarienti/nsfw-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use giacomoarienti/nsfw-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="giacomoarienti/nsfw-classifier") 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("giacomoarienti/nsfw-classifier") model = AutoModelForImageClassification.from_pretrained("giacomoarienti/nsfw-classifier", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Adding ONNX file of this model
Browse filesBeep boop I am the [ONNX export bot 🤖🏎️](https://huggingface.co/spaces/onnx/export). On behalf of [mrm8848](https://huggingface.co/mrm8848), I would like to add to this repository the model converted to ONNX.
What is ONNX? It stands for "Open Neural Network Exchange", and is the most commonly used open standard for machine learning interoperability. You can find out more at [onnx.ai](https://onnx.ai/)!
The exported ONNX model can be then be consumed by various backends as TensorRT or TVM, or simply be used in a few lines with 🤗 Optimum through ONNX Runtime, check out how [here](https://huggingface.co/docs/optimum/main/en/onnxruntime/usage_guides/models)!
- onnx/config.json +39 -0
- onnx/model.onnx +3 -0
onnx/config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_attn_implementation_autoset": true,
|
| 3 |
+
"_name_or_path": "onnx/giacomoarienti/nsfw-classifier/checkpoint-500",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"ViTForImageClassification"
|
| 6 |
+
],
|
| 7 |
+
"attention_probs_dropout_prob": 0.0,
|
| 8 |
+
"encoder_stride": 16,
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.0,
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "drawings",
|
| 14 |
+
"1": "hentai",
|
| 15 |
+
"2": "neutral",
|
| 16 |
+
"3": "porn",
|
| 17 |
+
"4": "sexy"
|
| 18 |
+
},
|
| 19 |
+
"image_size": 224,
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"intermediate_size": 3072,
|
| 22 |
+
"label2id": {
|
| 23 |
+
"drawings": "0",
|
| 24 |
+
"hentai": "1",
|
| 25 |
+
"neutral": "2",
|
| 26 |
+
"porn": "3",
|
| 27 |
+
"sexy": "4"
|
| 28 |
+
},
|
| 29 |
+
"layer_norm_eps": 1e-12,
|
| 30 |
+
"model_type": "vit",
|
| 31 |
+
"num_attention_heads": 12,
|
| 32 |
+
"num_channels": 3,
|
| 33 |
+
"num_hidden_layers": 12,
|
| 34 |
+
"patch_size": 16,
|
| 35 |
+
"problem_type": "single_label_classification",
|
| 36 |
+
"qkv_bias": true,
|
| 37 |
+
"torch_dtype": "float32",
|
| 38 |
+
"transformers_version": "4.49.0"
|
| 39 |
+
}
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52ec81a9a28e6a3c741ec279c6e1af4d4a894851689161c79c4bbe3553c7fbb8
|
| 3 |
+
size 343505706
|