Image-Text-to-Text
Transformers
Safetensors
PyTorch
English
qwen3_5
decision-model
text-generation-inference
SFT
image-classification
OneDecision
VisionGuard
qwen3.8-27B
JSON
content-safety
content-moderation
multimodal
safety-classifier
guardrail
visual-safety
multimodal-content-filter
uncensored
conversational
Instructions to use prithivMLmods/OneDecision-VisionGuard-27B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/OneDecision-VisionGuard-27B-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/OneDecision-VisionGuard-27B-SFT") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/OneDecision-VisionGuard-27B-SFT") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/OneDecision-VisionGuard-27B-SFT", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/OneDecision-VisionGuard-27B-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/OneDecision-VisionGuard-27B-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/OneDecision-VisionGuard-27B-SFT", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT
- SGLang
How to use prithivMLmods/OneDecision-VisionGuard-27B-SFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/OneDecision-VisionGuard-27B-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/OneDecision-VisionGuard-27B-SFT", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/OneDecision-VisionGuard-27B-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/OneDecision-VisionGuard-27B-SFT", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use prithivMLmods/OneDecision-VisionGuard-27B-SFT with Docker Model Runner:
docker model run hf.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT
File size: 13,672 Bytes
0c1d69e e498b10 d18ebdd d7596c7 d18ebdd d66154e 68eb763 49e4df1 68eb763 3503834 7772be4 37d9b03 d7596c7 37d9b03 452a391 37d9b03 d66154e 37d9b03 8715b79 37d9b03 d66154e 37d9b03 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | ---
pipeline_tag: image-text-to-text
library_name: transformers
tags:
- decision-model
- text-generation-inference
- SFT
- image-classification
- OneDecision
- VisionGuard
- qwen3.8-27B
- pytorch
- JSON
- content-safety
- content-moderation
- multimodal
- safety-classifier
- guardrail
- visual-safety
- multimodal-content-filter
- uncensored
base_model:
- Qwen/Qwen3.8-27B
license: apache-2.0
language:
- en
datasets:
- prithivMLmods/ImageShield-OneDecision-Classification
---

<p align="center">
<a href="https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT#model-variants" target="_blank">📦 Model Variants</a> |
<a href="https://huggingface.co/spaces/prithivMLmods/OneDecision-VisionGuard-Demo" target="_blank">🤗 HF Demo</a> |
<a href="https://huggingface.co/collections/prithivMLmods/onedecision-visionguard" target="_blank">🛢️ Collection</a> |
<a href="https://github.com/PRITHIVSAKTHIUR/OneDecision-VisionGuard-Demo" target="_blank">🔗 GitHub</a>
</p>
# **OneDecision-VisionGuard-27B-SFT**
> **OneDecision-VisionGuard-27B-SFT** is a dense 27-billion-parameter multimodal image classification model based on Qwen/Qwen3.8-27B and trained on the [ImageShield-OneDecision-Classification](https://huggingface.co/datasets/prithivMLmods/ImageShield-OneDecision-Classification) content-safety guardrail dataset. The model is designed to classify visual content as Safe or NSFW, with a particular focus on detecting Not Safe for Work (NSFW) sensual content and other potentially sensitive visual content. OneDecision-VisionGuard-27B-SFT performs detailed visual analysis of dress codes, clothing exposure, poses, framing, and visual settings to support conservative content-safety classification.
> [!IMPORTANT]
> **This model is intended for research and content-safety classification only.** Any outputs generated by this model are the sole responsibility of the user. The authors and hosting platform disclaim all liability for generated content. Users must ensure safe, ethical, and lawful usage.
## **Key Highlights**
* **Qwen 3.8 Foundation**: Built on **Qwen/Qwen3.8-27B**.
* **Dense 27B Architecture**: A dense **27-billion-parameter** multimodal model.
* **Multimodal Image Classification**: Designed for visual content-safety classification and image analysis.
* **ImageShield-OneDecision-Classification Training**: Fine-tuned on the **prithivMLmods/ImageShield-OneDecision-Classification** content-safety guardrail dataset.
* **Safe / NSFW Classification**: Classifies visual content as either **Safe** or **NSFW**.
* **NSFW Sensual Content Detection**: Focused on identifying potentially **Not Safe for Work (NSFW) sensual content** and related sensitive visual material.
* **Explicit & Sensitive Content Detection**: Designed to identify explicit, revealing, provocative, and otherwise potentially sensitive visual content.
* **Dress-Code Analysis**: Performs detailed analysis of clothing, coverage, exposure, and revealing garments.
* **Pose Analysis**: Analyzes body poses, positioning, framing, and potentially suggestive presentation.
* **Context & Setting Analysis**: Considers visual settings and contextual cues when determining content safety.
* **Zero-Tolerance Safety Classification**: Uses a conservative classification policy that favors safety when content is ambiguous.
* **Structured Output**: Produces a machine-readable JSON response containing a scene description, classification, and reasoning.
## **Standard Prompt**
```text
You are a strict content-safety guardrail classifier for images designed for parental control and minor protection.
Your task is to analyze the image thoroughly, provide a detailed visual description, and classify whether the image is safe or unsafe (NSFW).
Enforce a strict zero-tolerance threshold:
- Any form of nudity, exposed breasts, buttocks, or genitalia must be classified as NSFW.
- Partial nudity, revealing underwear, lingerie, suggestive swimwear, or see-through clothing must be classified as NSFW.
- Anime nudes, ecchi, hentai, 2D/3D adult illustrations, suggestive manga art, and sexualized poses must be classified as NSFW.
- Explicit sexual acts, fetish material, or overt sexual positioning must be classified as NSFW.
- When in doubt, classify as NSFW.
Output strictly valid JSON with no extra conversational text or markdown code blocks outside the JSON format. Use exactly these keys in this order:
{
"scene_description": "<Detailed, objective description of the subject, clothing, exposure, and pose>",
"is_nsfw": true | false,
"classification_reason": "<Precise reason for the classification based on clothing, exposure, or pose>",
"nsfw": 1 | 0,
"safe": 1 | 0
}
Field constraints:
- "is_nsfw" must be a JSON boolean (true or false), never a string.
- "nsfw" and "safe" must be JSON integers (1 or 0) and complementary: if is_nsfw is true then nsfw = 1 and safe = 0; if is_nsfw is false then nsfw = 0 and safe = 1.
```
> [!NOTE]
> If you are using the transformers inference, the **Standard Prompt is optional**, you can use simple prompts like `"Classify this image as safe or nsfw."` to get the classification. The **Standard Prompt** is used in the **GGUF Quantizations and others**.
## **Quick Start with Transformers**
```bash
pip install transformers
pip install accelerate
```
```python
from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
import torch
# default: Load the model on the available device(s)
model = Qwen3_5ForConditionalGeneration.from_pretrained(
"prithivMLmods/OneDecision-VisionGuard-27B-SFT",
dtype="auto",
device_map="auto"
)
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image scenarios.
# model = Qwen3_5ForConditionalGeneration.from_pretrained(
# "prithivMLmods/OneDecision-VisionGuard-27B-SFT",
# dtype=torch.bfloat16,
# attn_implementation="flash_attention_2",
# device_map="auto",
# )
processor = AutoProcessor.from_pretrained("prithivMLmods/OneDecision-VisionGuard-27B-SFT")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://path/to/your/image.jpg",
},
{
"type": "text",
"text": "Classify this image as safe or nsfw."
},
],
}
]
# Preparation for inference
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
)
inputs = inputs.to(model.device)
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=256)
generated_ids_trimmed = [
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])
```
## **Sample Outputs**
```json
{"scene_description": "Two young Rottweiler puppies are playfully wrestling on a grassy lawn scattered with fallen leaves. The puppy on top has its mouth open, biting down gently on the other's head, while the second puppy lies on its back with paws raised in the air.", "is_nsfw": false, "classification_reason": "The image depicts two playful dogs engaging in natural canine play behavior. There is no evidence of nudity, revealing swimwear, suggestive poses, or any other elements that would indicate an NSFW classification.", "nsfw": 0, "safe": 1}
```
```json
{"scene_description": "A middle-aged man with a beard stands in a kitchen, wearing a white t-shirt and grey pants. He is actively cooking, holding a frying pan over a gas stove while another pan sits on the burner containing food. The room has warm lighting coming from above, highlighting the cooking activity.", "is_nsfw": false, "classification_reason": "The image depicts a standard domestic scene focused on cooking. The subject is dressed in casual, everyday attire (t-shirt and trousers) suitable for a home environment. There is no evidence of nudity, revealing swimwear, suggestive poses, or any other content that would trigger the NSFW classification criteria.", "nsfw": 0, "safe": 1}
```
```json
{"scene_description": "A blonde woman wearing sunglasses and a patterned skirt stands outdoors in a park setting, embracing another person whose upper body is largely exposed. The woman's attire includes pink bikini bottoms and a sheer, semi-transparent top that reveals her midriff and bare chest.", "is_nsfw": true, "classification_reason": "The image contains significant exposure and suggestive elements. The central figure is partially nude, showing bare skin on the torso and arms. She wears a sheer, see-through top that exposes her midriff and cleavage, along with pink bikini bottoms. The outdoor setting combined with the intimate embrace and lack of full coverage classifies this as NSFW content.", "nsfw": 1, "safe": 0}
```
## **Intended Use**
* **Multimodal Image Classification**: Classifying visual media as safe or NSFW.
* **Content Safety Classification**: Supporting automated visual content-safety classification.
* **NSFW Sensual Content Detection**: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.
* **Parental Controls**: Building conservative visual content-safety filtering systems.
* **Content Moderation**: Supporting automated safety classification pipelines.
* **Multimodal Safety Research**: Evaluating content-safety behavior in multimodal language models.
* **Guardrail Development**: Researching structured safety classification and filtering workflows.
* **Visual Safety Analysis**: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.
## **Limitations**
* **Experimental Model**: The model may produce incorrect or inconsistent classifications.
* **False Positives**: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.
* **False Negatives**: Unsafe content may occasionally be missed.
* **Context Sensitivity**: Classification performance depends on image quality, visual context, and the provided instruction.
* **Conservative Policy**: The model intentionally uses a strict classification threshold and may flag content that would not be considered NSFW under less restrictive moderation policies.
* **Visual Ambiguity**: Clothing, poses, artistic styles, and contextual cues may sometimes be difficult to interpret accurately.
* **Computational Requirements**: As a dense 27-billion-parameter multimodal model, OneDecision-VisionGuard-27B-SFT requires substantially more computational resources than smaller VisionGuardrail variants.
* **Automated Classification**: The model should not be treated as a definitive legal or safety determination.
## **Model Variants**
| Type | 27B | 9B | 4B |
|---|---|---|---|
| Model | [OneDecision-VisionGuard-27B-SFT](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT) | [OneDecision-VisionGuard-9B-SFT](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-9B-SFT) | [OneDecision-VisionGuard-4B-SFT](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-4B-SFT) |
| GGUF | [OneDecision-VisionGuard-27B-SFT-GGUF](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT-GGUF) | [OneDecision-VisionGuard-9B-SFT-GGUF](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-9B-SFT-GGUF) | [OneDecision-VisionGuard-4B-SFT-GGUF](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-4B-SFT-GGUF) |
| MLX | [OneDecision-VisionGuard-27B-SFT-MLX](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-27B-SFT-MLX) | [OneDecision-VisionGuard-9B-SFT-MLX](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-9B-SFT-MLX) | [OneDecision-VisionGuard-4B-SFT-MLX](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-4B-SFT-MLX) |
## **License and Attributions**
* **[Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)**: Base multimodal model used for this project.
* **[ImageShield-OneDecision-Classification](https://huggingface.co/datasets/prithivMLmods/ImageShield-OneDecision-Classification)**: A multimodal classification dataset in single-turn format targeted at one-pass decision-making for unsafe, sensitive, and policy-violating imagery. Each entry pairs a visual input with a serialized JSON string in the `Decision` column, delivering scene narration, classification rationale, boolean flags, and numeric class indicators. Used to train **OneDecision-VisionGuard-27B-SFT**.
* **Initial training**: **[strangeropshf/job-term-10_05-L](https://huggingface.co/strangeropshf/job-term-10_05-L)**
* **TRL** – **[Transformers Reinforcement Learning](https://huggingface.co/docs/trl/en/index)**: TRL is a full-stack library providing tools to train transformer language models with methods including Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more.
* **[Transformers](https://huggingface.co/docs/transformers/en/index)**: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.
* **Developed by**: **[prithivMLmods](https://huggingface.co/prithivMLmods)**
* **License**: This model follows the same **Apache 2.0** license as the base model **[Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)**. |