VIGOR-mini / README.md
prithivMLmods's picture
Update README.md
0c4cb1d verified
|
Raw History Blame Contribute Delete
10.6 kB
---
tags:
- text-generation-inference
- experimental
- mtp
- image-classification
- VIGOR
- VisionGuard
- qwen3.5-4B
- JSON
- content-safety
- content-moderation
- multimodal
- safety-classifier
- guardrail
- visual-safety
- multimodal-content-filter
- uncensored
base_model:
- Qwen/Qwen3.5-4B
license: apache-2.0
language:
- en
pipeline_tag: image-text-to-text
library_name: transformers
---
![1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/tvF1AcUq4ldMWqDxA4NHS.png)
# **VIGOR-mini**
> **VIGOR-mini (Vision Intelligence and Guardrail Oriented Reasoning)** is a dense 4-billion-parameter multimodal vision classification model based on **Qwen/Qwen3.5-4B**. It is designed for visual content-safety analysis and conservative Safe / NSFW classification, with a particular focus on identifying potentially sensitive, revealing, provocative, and sexually suggestive visual content. VIGOR-mini performs detailed visual analysis of clothing, dress codes, body exposure, poses, framing, and contextual settings to support structured content-safety decisions.
> [!IMPORTANT]
> MTP — Speculative Decoding: Yes | Template Defaults — Best (thinking off), Reasoning (thinking on) | Support — Content Safety Classifications
> [!IMPORTANT]
> VIGOR-mini is an experimental content-safety classification model. Its predictions should not be treated as definitive judgments. Review outputs before using them in moderation, parental-control, or other safety-critical workflows.
## **Key Highlights**
- **Qwen 3.5 Foundation:** Built on the Qwen/Qwen3.5-4B multimodal architecture.
- **Dense 4B Architecture:** A compact 4-billion-parameter model designed for local inference.
- **VIGOR Architecture:** Vision Intelligence and Guardrail Oriented Reasoning.
- **Multimodal Image Classification:** Analyzes visual content using image inputs.
- **Safe / NSFW Classification:** Provides binary content-safety classifications.
- **Sensual Content Detection:** Identifies potentially suggestive visual content.
- **Explicit and Sensitive Content Detection:** Focuses on visual exposure and potentially inappropriate content.
- **Dress-Code Analysis:** Examines clothing, revealing outfits, and levels of exposure.
- **Pose Analysis:** Evaluates poses and visual presentation.
- **Context and Setting:** Considers the surrounding visual context when classifying images.
- **Conservative Classification:** Uses a strict classification threshold for potentially unsafe content.
- **Structured JSON Output:** Produces consistent classification results with complementary safety indicators.
- **MTP Tensor Preservation:** Retains Multi-Token Prediction tensors for speculative decoding support.
## **Standard Prompt**
The following prompt is designed for strict content-safety classification and structured JSON output.
```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]
> The standard prompt is primarily intended for GGUF and other inference workflows that use an explicit system prompt. For Transformers inference, a shorter classification instruction can also be used.
## **Quickstart**
### Installation
```bash
pip install transformers
pip install accelerate
```
### Transformers Inference
```python
from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
import torch
# Load the model on the available device(s)
model = Qwen3_5ForConditionalGeneration.from_pretrained(
"prithivMLmods/VIGOR-mini",
dtype="auto",
device_map="auto"
)
# Recommended: Enable Flash Attention 2 for better acceleration
# and memory efficiency, especially in multi-image scenarios.
#
# model = Qwen3_5ForConditionalGeneration.from_pretrained(
# "prithivMLmods/VIGOR-mini",
# dtype=torch.bfloat16,
# attn_implementation="flash_attention_2",
# device_map="auto",
# )
processor = AutoProcessor.from_pretrained("prithivMLmods/VIGOR-mini")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://path/to/your/image.jpg",
},
{
"type": "text",
"text": "Classify this image as safe or nsfw."
},
],
}
]
# Prepare inputs 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)
# Generate the model 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**
### 1. Safe Classification
**Input:** An image showing two Rottweiler puppies playing and wrestling with each other.
**Output:**
```json
{
"scene_description": "Two Rottweiler puppies are playing and wrestling with each other. Both animals are fully covered by their natural fur, and the scene contains no sensitive or suggestive visual content.",
"is_nsfw": false,
"classification_reason": "The image depicts ordinary animal play with no nudity, explicit content, or suggestive visual elements.",
"nsfw": 0,
"safe": 1
}
```
### 2. Safe Classification
**Input:** An image showing a middle-aged man preparing food in a kitchen.
**Output:**
```json
{
"scene_description": "A middle-aged man is preparing food in a kitchen. He is engaged in an ordinary cooking activity, and the scene contains no revealing clothing or suggestive visual elements.",
"is_nsfw": false,
"classification_reason": "The image depicts a normal domestic activity without nudity, explicit content, or sexually suggestive presentation.",
"nsfw": 0,
"safe": 1
}
```
### 3. NSFW Classification
**Input:** An image showing a woman outdoors wearing a sheer top and bikini bottoms.
**Output:**
```json
{
"scene_description": "A woman is standing outdoors wearing a sheer top and bikini bottoms. The outfit exposes significant areas of the body and presents potentially revealing visual content.",
"is_nsfw": true,
"classification_reason": "The image contains revealing and partially transparent clothing that meets the strict content-safety threshold.",
"nsfw": 1,
"safe": 0
}
```
## **Intended Use**
VIGOR-mini is intended for:
- Multimodal Image Classification
- Content Safety Classification
- NSFW and Sensual Content Detection
- Parental Control Applications
- Image Content Moderation
- Multimodal Safety Research
- Guardrail Development
- Visual Safety Analysis
## **Limitations**
- **Experimental Model:** VIGOR-mini is an experimental multimodal classification model. Its outputs may contain unexpected behaviors or reasoning artifacts.
- **False Positives:** Conservative classification may flag otherwise acceptable images as unsafe.
- **False Negatives:** Some sensitive visual content may not be detected correctly.
- **Context Sensitivity:** Classification accuracy can vary depending on image context, composition, and visual ambiguity.
- **Conservative Policy:** The strict classification threshold may result in over-classification of borderline content.
- **Visual Ambiguity:** Clothing, poses, lighting, occlusion, and image quality can affect classification.
- **Computational Requirements:** Although based on a compact 4B architecture, inference requirements depend on the selected precision, hardware, and image resolution.
- **Automated Decisions:** Model predictions should not replace human review or serve as definitive legal, professional, or safety determinations.
## **License and Attributions**
- **Base Model:** [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) - The foundational multimodal model used for VIGOR-mini.
- **Previous Variant:** [prithivMLmods/OneDecision-VisionGuard-4B-SFT](https://huggingface.co/prithivMLmods/OneDecision-VisionGuard-4B-SFT).
- **Classification Improvements:** VIGOR-mini introduces improvements targeting marginal False Positive (FP / Type I Error) and False Negative (FN / Type II Error) classification errors, aiming for more reliable and consistent visual content-safety decisions.
- **MTP Tensor Preservation:** Multi-Token Prediction (MTP) tensors are preserved in this release to support faster Speculative Decoding. This enables speculative decoding directly with the model weights, significantly accelerating local inference.
- **TRL:** [Transformers Reinforcement Learning](https://huggingface.co/docs/trl/en/index) - A full-stack library for supervised fine-tuning, GRPO, DPO, and reward modeling.
- **Transformers:** [Hugging Face Transformers](https://huggingface.co/docs/transformers/en/index) - Provides models and tools for text, computer vision, audio, video, and multimodal inference and training.
- **Developed by:** [prithivMLmods](https://huggingface.co/prithivMLmods).
- **License:** VIGOR-mini follows the Apache 2.0 license of the base Qwen/Qwen3.5-4B model, subject to applicable model and component terms.