Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
VisionGuardrail
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
visual-safety
multimodal-content-filter
mmcf
v1.0
conversational
Instructions to use prithivMLmods/VisionGuardrail-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/VisionGuardrail-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/VisionGuardrail-4B") 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/VisionGuardrail-4B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/VisionGuardrail-4B", 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/VisionGuardrail-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/VisionGuardrail-4B" # 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/VisionGuardrail-4B", "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/VisionGuardrail-4B
- SGLang
How to use prithivMLmods/VisionGuardrail-4B 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/VisionGuardrail-4B" \ --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/VisionGuardrail-4B", "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/VisionGuardrail-4B" \ --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/VisionGuardrail-4B", "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/VisionGuardrail-4B with Docker Model Runner:
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,292 +1,271 @@
|
|
| 1 |
-
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,
|
| 2 |
|
| 3 |
<style>
|
| 4 |
-
.vg-
|
| 5 |
font-family: 'Ubuntu', sans-serif;
|
| 6 |
background-color: #000000;
|
| 7 |
color: #FFFFFF;
|
| 8 |
-
max-width:
|
| 9 |
margin: 0 auto;
|
| 10 |
-
padding:
|
| 11 |
line-height: 1.65;
|
| 12 |
-
box-sizing: border-box;
|
| 13 |
}
|
| 14 |
|
| 15 |
-
.vg-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
font-size: 34px;
|
| 22 |
font-weight: 700;
|
| 23 |
-
letter-spacing: -0.5px;
|
| 24 |
color: #FFFFFF;
|
| 25 |
-
margin: 0 0
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
-
.vg-
|
| 29 |
font-size: 15px;
|
| 30 |
-
font-weight: 400;
|
| 31 |
color: #FFFFFF;
|
| 32 |
-
margin
|
| 33 |
-
line-height: 1.7;
|
| 34 |
}
|
| 35 |
|
| 36 |
-
.vg-
|
| 37 |
color: #FF4500;
|
| 38 |
text-decoration: none;
|
| 39 |
font-weight: 500;
|
| 40 |
-
transition: opacity 0.2s;
|
| 41 |
}
|
| 42 |
|
| 43 |
-
.vg-
|
| 44 |
text-decoration: underline;
|
| 45 |
-
opacity: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
|
| 48 |
-
.vg-
|
| 49 |
font-size: 20px;
|
| 50 |
font-weight: 700;
|
| 51 |
color: #FFFFFF;
|
| 52 |
-
margin
|
| 53 |
-
|
|
|
|
| 54 |
display: flex;
|
| 55 |
align-items: center;
|
| 56 |
-
gap: 10px;
|
| 57 |
-
letter-spacing: -0.2px;
|
| 58 |
}
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
margin: 24px 0 32px 0;
|
| 67 |
-
font-size: 13.5px;
|
| 68 |
-
color: #FFFFFF;
|
| 69 |
-
line-height: 1.6;
|
| 70 |
}
|
| 71 |
|
| 72 |
-
|
| 73 |
-
.vg-list {
|
| 74 |
list-style: none;
|
| 75 |
-
padding: 0;
|
| 76 |
-
margin: 0 0
|
| 77 |
}
|
| 78 |
|
| 79 |
-
.vg-list li {
|
| 80 |
position: relative;
|
| 81 |
-
padding-left:
|
| 82 |
margin-bottom: 12px;
|
| 83 |
-
font-size:
|
| 84 |
color: #FFFFFF;
|
| 85 |
}
|
| 86 |
|
| 87 |
-
.vg-list li::before {
|
| 88 |
content: "+";
|
| 89 |
color: #FF4500;
|
| 90 |
position: absolute;
|
| 91 |
-
left:
|
| 92 |
-
top: -1px;
|
| 93 |
-
font-size: 18px;
|
| 94 |
font-weight: 700;
|
|
|
|
| 95 |
line-height: 1.2;
|
| 96 |
}
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
border:
|
| 101 |
-
border-radius: 6px;
|
| 102 |
-
background: #050505;
|
| 103 |
margin-bottom: 24px;
|
| 104 |
-
|
| 105 |
}
|
| 106 |
|
| 107 |
-
.vg-summary {
|
| 108 |
-
padding:
|
| 109 |
font-size: 15px;
|
| 110 |
font-weight: 700;
|
| 111 |
-
color: #FFFFFF;
|
| 112 |
-
background: #080808;
|
| 113 |
cursor: pointer;
|
|
|
|
|
|
|
| 114 |
user-select: none;
|
| 115 |
display: flex;
|
| 116 |
-
align-items: center;
|
| 117 |
justify-content: space-between;
|
| 118 |
-
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
.vg-summary:hover {
|
| 122 |
-
background: #111111;
|
| 123 |
}
|
| 124 |
|
| 125 |
-
.vg-summary::-webkit-details-marker {
|
| 126 |
display: none;
|
| 127 |
}
|
| 128 |
|
| 129 |
-
.vg-summary::after {
|
| 130 |
content: "+";
|
| 131 |
color: #FF4500;
|
| 132 |
-
font-size:
|
| 133 |
font-weight: 700;
|
| 134 |
-
transition: transform 0.2s;
|
| 135 |
}
|
| 136 |
|
| 137 |
-
.vg-
|
| 138 |
-
content: "
|
| 139 |
}
|
| 140 |
|
| 141 |
-
.vg-accordion-content {
|
| 142 |
-
border-top: 1px solid #1a1a1a;
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
/* Code Blocks & Copy Buttons */
|
| 146 |
.vg-code-wrapper {
|
| 147 |
position: relative;
|
| 148 |
-
background: #050505;
|
| 149 |
border: 1px solid #222222;
|
| 150 |
-
border-radius:
|
|
|
|
| 151 |
margin-bottom: 20px;
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
-
.vg-code-
|
| 155 |
-
display: flex;
|
| 156 |
-
justify-content: space-between;
|
| 157 |
-
align-items: center;
|
| 158 |
padding: 8px 16px;
|
| 159 |
-
background: #080808;
|
| 160 |
-
border-bottom: 1px solid #
|
|
|
|
| 161 |
font-size: 12px;
|
| 162 |
-
color: #
|
| 163 |
-
font-family: 'JetBrains Mono', monospace;
|
| 164 |
}
|
| 165 |
|
| 166 |
.vg-copy-btn {
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
| 168 |
color: #FFFFFF;
|
| 169 |
border: 1px solid #333333;
|
| 170 |
border-radius: 4px;
|
| 171 |
-
padding:
|
| 172 |
font-family: 'Ubuntu', sans-serif;
|
| 173 |
-
font-size:
|
| 174 |
cursor: pointer;
|
| 175 |
-
|
| 176 |
-
align-items: center;
|
| 177 |
-
gap: 6px;
|
| 178 |
-
transition: all 0.2s ease;
|
| 179 |
}
|
| 180 |
|
| 181 |
.vg-copy-btn:hover {
|
| 182 |
-
background: #1c1c1c;
|
| 183 |
border-color: #555555;
|
| 184 |
}
|
| 185 |
|
| 186 |
-
.vg-
|
| 187 |
margin: 0;
|
| 188 |
padding: 16px;
|
| 189 |
overflow-x: auto;
|
| 190 |
-
font-family: '
|
| 191 |
-
font-size:
|
| 192 |
-
line-height: 1.55;
|
| 193 |
color: #FFFFFF;
|
| 194 |
-
|
|
|
|
| 195 |
}
|
| 196 |
|
| 197 |
-
|
| 198 |
-
.vg-meta-table {
|
| 199 |
-
width: 100%;
|
| 200 |
-
border-collapse: separate;
|
| 201 |
-
border-spacing: 0;
|
| 202 |
border: 1px solid #222222;
|
| 203 |
-
border-radius:
|
| 204 |
-
margin-bottom: 32px;
|
| 205 |
overflow: hidden;
|
| 206 |
-
|
| 207 |
}
|
| 208 |
|
| 209 |
-
.vg-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
|
| 213 |
-
.vg-
|
|
|
|
| 214 |
padding: 12px 18px;
|
| 215 |
-
|
| 216 |
color: #FFFFFF;
|
| 217 |
}
|
| 218 |
|
| 219 |
-
.vg-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
font-weight: 500;
|
| 223 |
-
border-right: 1px solid #1a1a1a;
|
| 224 |
-
color: #FFFFFF;
|
| 225 |
}
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
border-radius: 6px;
|
| 232 |
-
background: #040404;
|
| 233 |
-
margin-bottom: 12px;
|
| 234 |
-
font-size: 13.5px;
|
| 235 |
}
|
| 236 |
-
</style>
|
| 237 |
|
| 238 |
-
|
| 239 |
-
|
|
|
|
|
|
|
| 240 |
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
-
<div class="vg-
|
| 246 |
This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <b>This model is intended for research and content-safety classification only.</b> 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.
|
| 247 |
</div>
|
| 248 |
|
| 249 |
-
<div class="vg-
|
| 250 |
-
<ul class="vg-list">
|
| 251 |
<li><b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</li>
|
| 252 |
<li><b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</li>
|
| 253 |
-
<li><b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <
|
| 254 |
<li><b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</li>
|
| 255 |
<li><b>NSFW Sensual Content Detection</b>: Focused on identifying potentially <b>Not Safe for Work (NSFW) sensual content</b> and related sensitive visual material.</li>
|
| 256 |
-
<li><b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li>
|
| 257 |
<li><b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li>
|
| 258 |
<li><b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li>
|
| 259 |
-
<li><b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</li>
|
| 260 |
<li><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li>
|
| 261 |
<li><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li>
|
| 262 |
</ul>
|
| 263 |
|
| 264 |
-
<div class="vg-
|
| 265 |
-
<details class="vg-
|
| 266 |
-
<summary class="vg-summary">View Guardrail System Prompt</summary>
|
| 267 |
-
<div class="vg-
|
| 268 |
-
<
|
| 269 |
-
|
| 270 |
-
<span>SYSTEM INSTRUCTION • JSON SPEC</span>
|
| 271 |
-
<button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy Prompt</button>
|
| 272 |
-
</div>
|
| 273 |
-
<pre class="vg-pre">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.
|
| 274 |
|
| 275 |
Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.
|
| 276 |
|
| 277 |
STRICT ZERO-TOLERANCE CLASSIFICATION RULES:
|
| 278 |
|
| 279 |
-
1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.
|
| 280 |
|
| 281 |
-
2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.
|
| 282 |
|
| 283 |
3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.
|
| 284 |
|
| 285 |
-
4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.
|
| 286 |
|
| 287 |
-
5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.
|
| 288 |
|
| 289 |
-
6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.
|
| 290 |
|
| 291 |
7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.
|
| 292 |
|
|
@@ -301,26 +280,22 @@ Output strictly valid JSON with no extra conversational text, commentary, or mar
|
|
| 301 |
"nsfw": 1 | 0,
|
| 302 |
"safe": 1 | 0
|
| 303 |
}</pre>
|
| 304 |
-
</div>
|
| 305 |
</div>
|
| 306 |
</details>
|
| 307 |
|
| 308 |
-
<div class="vg-
|
|
|
|
| 309 |
<div class="vg-code-wrapper">
|
| 310 |
-
<div class="vg-code-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
</div>
|
| 314 |
-
<pre class="vg-pre">pip install transformers
|
| 315 |
pip install accelerate</pre>
|
| 316 |
</div>
|
| 317 |
|
| 318 |
<div class="vg-code-wrapper">
|
| 319 |
-
<div class="vg-code-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
</div>
|
| 323 |
-
<pre class="vg-pre">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
|
| 324 |
import torch
|
| 325 |
|
| 326 |
model = Qwen3_5ForConditionalGeneration.from_pretrained(
|
|
@@ -374,21 +349,26 @@ output_text = processor.batch_decode(
|
|
| 374 |
print(output_text[0])</pre>
|
| 375 |
</div>
|
| 376 |
|
| 377 |
-
<div class="vg-
|
| 378 |
-
<
|
| 379 |
-
<
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
<li><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</li>
|
| 393 |
<li><b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li>
|
| 394 |
<li><b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</li>
|
|
@@ -398,8 +378,8 @@ print(output_text[0])</pre>
|
|
| 398 |
<li><b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li>
|
| 399 |
</ul>
|
| 400 |
|
| 401 |
-
<div class="vg-
|
| 402 |
-
<ul class="vg-list">
|
| 403 |
<li><b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</li>
|
| 404 |
<li><b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li>
|
| 405 |
<li><b>False Negatives</b>: Unsafe content may occasionally be missed.</li>
|
|
@@ -409,39 +389,35 @@ print(output_text[0])</pre>
|
|
| 409 |
<li><b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</li>
|
| 410 |
</ul>
|
| 411 |
|
| 412 |
-
<div class="vg-
|
| 413 |
-
<div class="vg-ack-
|
| 414 |
-
<
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
<a href="https://huggingface.co/docs/trl/en/index" target="_blank" rel="noopener noreferrer" class="vg-a">TRL</a> – Transformers Reinforcement Learning: 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.
|
| 421 |
-
</div>
|
| 422 |
-
<div class="vg-ack-card">
|
| 423 |
-
<a href="https://huggingface.co/docs/transformers/en/index" target="_blank" rel="noopener noreferrer" class="vg-a">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.
|
| 424 |
</div>
|
| 425 |
</div>
|
| 426 |
|
| 427 |
<script>
|
| 428 |
-
function vgCopyCode(
|
| 429 |
-
var
|
| 430 |
-
var codeElement =
|
| 431 |
-
var
|
| 432 |
|
| 433 |
if (navigator.clipboard && window.isSecureContext) {
|
| 434 |
-
navigator.clipboard.writeText(
|
| 435 |
-
showSuccess(
|
| 436 |
}).catch(function() {
|
| 437 |
-
fallbackCopy(
|
| 438 |
});
|
| 439 |
} else {
|
| 440 |
-
fallbackCopy(
|
| 441 |
}
|
| 442 |
}
|
| 443 |
|
| 444 |
-
function fallbackCopy(text,
|
| 445 |
var textArea = document.createElement("textarea");
|
| 446 |
textArea.value = text;
|
| 447 |
textArea.style.position = "fixed";
|
|
@@ -452,20 +428,17 @@ print(output_text[0])</pre>
|
|
| 452 |
textArea.select();
|
| 453 |
try {
|
| 454 |
document.execCommand('copy');
|
| 455 |
-
showSuccess(
|
| 456 |
} catch (err) {
|
| 457 |
-
|
| 458 |
}
|
| 459 |
document.body.removeChild(textArea);
|
| 460 |
}
|
| 461 |
|
| 462 |
-
function showSuccess(
|
| 463 |
-
|
| 464 |
-
button.innerText = "Copied!";
|
| 465 |
-
button.style.borderColor = "#FF4500";
|
| 466 |
setTimeout(function() {
|
| 467 |
-
|
| 468 |
-
button.style.borderColor = "#333333";
|
| 469 |
}, 2000);
|
| 470 |
}
|
| 471 |
</script>
|
|
|
|
| 1 |
+
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,400;0,500;0,700;1,400&family=Ubuntu+Mono&display=swap" rel="stylesheet">
|
| 2 |
|
| 3 |
<style>
|
| 4 |
+
.vg-container {
|
| 5 |
font-family: 'Ubuntu', sans-serif;
|
| 6 |
background-color: #000000;
|
| 7 |
color: #FFFFFF;
|
| 8 |
+
max-width: 920px;
|
| 9 |
margin: 0 auto;
|
| 10 |
+
padding: 32px 24px;
|
| 11 |
line-height: 1.65;
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
+
.vg-header {
|
| 15 |
+
border-bottom: 2px solid #222222;
|
| 16 |
+
padding-bottom: 16px;
|
| 17 |
+
margin-bottom: 24px;
|
| 18 |
}
|
| 19 |
|
| 20 |
+
.vg-title {
|
| 21 |
+
font-size: 32px;
|
|
|
|
| 22 |
font-weight: 700;
|
|
|
|
| 23 |
color: #FFFFFF;
|
| 24 |
+
margin: 0 0 12px 0;
|
| 25 |
+
letter-spacing: -0.5px;
|
| 26 |
}
|
| 27 |
|
| 28 |
+
.vg-description {
|
| 29 |
font-size: 15px;
|
|
|
|
| 30 |
color: #FFFFFF;
|
| 31 |
+
margin: 0;
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
+
.vg-link {
|
| 35 |
color: #FF4500;
|
| 36 |
text-decoration: none;
|
| 37 |
font-weight: 500;
|
| 38 |
+
transition: opacity 0.2s ease;
|
| 39 |
}
|
| 40 |
|
| 41 |
+
.vg-link:hover {
|
| 42 |
text-decoration: underline;
|
| 43 |
+
opacity: 0.85;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.vg-notice-panel {
|
| 47 |
+
background-color: #000000;
|
| 48 |
+
border: 1px solid #333333;
|
| 49 |
+
border-radius: 8px;
|
| 50 |
+
padding: 16px 20px;
|
| 51 |
+
margin: 24px 0;
|
| 52 |
+
font-size: 14px;
|
| 53 |
+
color: #FFFFFF;
|
| 54 |
}
|
| 55 |
|
| 56 |
+
.vg-section-title {
|
| 57 |
font-size: 20px;
|
| 58 |
font-weight: 700;
|
| 59 |
color: #FFFFFF;
|
| 60 |
+
margin: 36px 0 16px 0;
|
| 61 |
+
text-transform: uppercase;
|
| 62 |
+
letter-spacing: 0.5px;
|
| 63 |
display: flex;
|
| 64 |
align-items: center;
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
+
.vg-section-title::after {
|
| 68 |
+
content: "";
|
| 69 |
+
flex: 1;
|
| 70 |
+
height: 1px;
|
| 71 |
+
background-color: #222222;
|
| 72 |
+
margin-left: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
+
.vg-plus-list {
|
|
|
|
| 76 |
list-style: none;
|
| 77 |
+
padding-left: 0;
|
| 78 |
+
margin: 0 0 24px 0;
|
| 79 |
}
|
| 80 |
|
| 81 |
+
.vg-plus-list li {
|
| 82 |
position: relative;
|
| 83 |
+
padding-left: 24px;
|
| 84 |
margin-bottom: 12px;
|
| 85 |
+
font-size: 15px;
|
| 86 |
color: #FFFFFF;
|
| 87 |
}
|
| 88 |
|
| 89 |
+
.vg-plus-list li::before {
|
| 90 |
content: "+";
|
| 91 |
color: #FF4500;
|
| 92 |
position: absolute;
|
| 93 |
+
left: 0;
|
|
|
|
|
|
|
| 94 |
font-weight: 700;
|
| 95 |
+
font-size: 18px;
|
| 96 |
line-height: 1.2;
|
| 97 |
}
|
| 98 |
|
| 99 |
+
.vg-dropdown {
|
| 100 |
+
border: 1px solid #333333;
|
| 101 |
+
border-radius: 8px;
|
|
|
|
|
|
|
| 102 |
margin-bottom: 24px;
|
| 103 |
+
background-color: #000000;
|
| 104 |
}
|
| 105 |
|
| 106 |
+
.vg-dropdown-summary {
|
| 107 |
+
padding: 14px 18px;
|
| 108 |
font-size: 15px;
|
| 109 |
font-weight: 700;
|
|
|
|
|
|
|
| 110 |
cursor: pointer;
|
| 111 |
+
color: #FFFFFF;
|
| 112 |
+
outline: none;
|
| 113 |
user-select: none;
|
| 114 |
display: flex;
|
|
|
|
| 115 |
justify-content: space-between;
|
| 116 |
+
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
+
.vg-dropdown-summary::-webkit-details-marker {
|
| 120 |
display: none;
|
| 121 |
}
|
| 122 |
|
| 123 |
+
.vg-dropdown-summary::after {
|
| 124 |
content: "+";
|
| 125 |
color: #FF4500;
|
| 126 |
+
font-size: 18px;
|
| 127 |
font-weight: 700;
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
+
.vg-dropdown[open] .vg-dropdown-summary::after {
|
| 131 |
+
content: "−";
|
| 132 |
}
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
.vg-code-wrapper {
|
| 135 |
position: relative;
|
|
|
|
| 136 |
border: 1px solid #222222;
|
| 137 |
+
border-radius: 8px;
|
| 138 |
+
background-color: #000000;
|
| 139 |
margin-bottom: 20px;
|
| 140 |
+
overflow: hidden;
|
| 141 |
}
|
| 142 |
|
| 143 |
+
.vg-code-label {
|
|
|
|
|
|
|
|
|
|
| 144 |
padding: 8px 16px;
|
| 145 |
+
background-color: #080808;
|
| 146 |
+
border-bottom: 1px solid #222222;
|
| 147 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 148 |
font-size: 12px;
|
| 149 |
+
color: #FFFFFF;
|
|
|
|
| 150 |
}
|
| 151 |
|
| 152 |
.vg-copy-btn {
|
| 153 |
+
position: absolute;
|
| 154 |
+
top: 6px;
|
| 155 |
+
right: 8px;
|
| 156 |
+
background-color: #000000;
|
| 157 |
color: #FFFFFF;
|
| 158 |
border: 1px solid #333333;
|
| 159 |
border-radius: 4px;
|
| 160 |
+
padding: 4px 10px;
|
| 161 |
font-family: 'Ubuntu', sans-serif;
|
| 162 |
+
font-size: 11px;
|
| 163 |
cursor: pointer;
|
| 164 |
+
transition: border-color 0.2s ease;
|
|
|
|
|
|
|
|
|
|
| 165 |
}
|
| 166 |
|
| 167 |
.vg-copy-btn:hover {
|
|
|
|
| 168 |
border-color: #555555;
|
| 169 |
}
|
| 170 |
|
| 171 |
+
.vg-code-block {
|
| 172 |
margin: 0;
|
| 173 |
padding: 16px;
|
| 174 |
overflow-x: auto;
|
| 175 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 176 |
+
font-size: 13.5px;
|
|
|
|
| 177 |
color: #FFFFFF;
|
| 178 |
+
line-height: 1.5;
|
| 179 |
+
background-color: #000000;
|
| 180 |
}
|
| 181 |
|
| 182 |
+
.vg-table-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
border: 1px solid #222222;
|
| 184 |
+
border-radius: 8px;
|
|
|
|
| 185 |
overflow: hidden;
|
| 186 |
+
margin-bottom: 28px;
|
| 187 |
}
|
| 188 |
|
| 189 |
+
.vg-spec-table {
|
| 190 |
+
width: 100%;
|
| 191 |
+
border-collapse: collapse;
|
| 192 |
+
font-size: 14px;
|
| 193 |
+
background-color: #000000;
|
| 194 |
+
text-align: left;
|
| 195 |
}
|
| 196 |
|
| 197 |
+
.vg-spec-table th,
|
| 198 |
+
.vg-spec-table td {
|
| 199 |
padding: 12px 18px;
|
| 200 |
+
border-bottom: 1px solid #222222;
|
| 201 |
color: #FFFFFF;
|
| 202 |
}
|
| 203 |
|
| 204 |
+
.vg-spec-table tr:last-child th,
|
| 205 |
+
.vg-spec-table tr:last-child td {
|
| 206 |
+
border-bottom: none;
|
|
|
|
|
|
|
|
|
|
| 207 |
}
|
| 208 |
|
| 209 |
+
.vg-spec-table th {
|
| 210 |
+
width: 35%;
|
| 211 |
+
font-weight: 700;
|
| 212 |
+
background-color: #050505;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
}
|
|
|
|
| 214 |
|
| 215 |
+
.vg-ack-container {
|
| 216 |
+
margin-bottom: 16px;
|
| 217 |
+
}
|
| 218 |
+
</style>
|
| 219 |
|
| 220 |
+
<div class="vg-container">
|
| 221 |
+
<div class="vg-header">
|
| 222 |
+
<h1 class="vg-title">VisionGuardrail-4B</h1>
|
| 223 |
+
<p class="vg-description">
|
| 224 |
+
<b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.
|
| 225 |
+
</p>
|
| 226 |
+
</div>
|
| 227 |
|
| 228 |
+
<div class="vg-notice-panel">
|
| 229 |
This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <b>This model is intended for research and content-safety classification only.</b> 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.
|
| 230 |
</div>
|
| 231 |
|
| 232 |
+
<div class="vg-section-title">Key Highlights</div>
|
| 233 |
+
<ul class="vg-plus-list">
|
| 234 |
<li><b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</li>
|
| 235 |
<li><b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</li>
|
| 236 |
+
<li><b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset.</li>
|
| 237 |
<li><b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</li>
|
| 238 |
<li><b>NSFW Sensual Content Detection</b>: Focused on identifying potentially <b>Not Safe for Work (NSFW) sensual content</b> and related sensitive visual material.</li>
|
| 239 |
+
<li><b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li>
|
| 240 |
<li><b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li>
|
| 241 |
<li><b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li>
|
| 242 |
+
<li><b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</li>
|
| 243 |
<li><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li>
|
| 244 |
<li><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li>
|
| 245 |
</ul>
|
| 246 |
|
| 247 |
+
<div class="vg-section-title">Standard Instruction</div>
|
| 248 |
+
<details class="vg-dropdown">
|
| 249 |
+
<summary class="vg-dropdown-summary">View Guardrail Zero-Tolerance System Prompt</summary>
|
| 250 |
+
<div class="vg-code-wrapper" style="border: none; border-top: 1px solid #222222; border-radius: 0; margin-bottom: 0;">
|
| 251 |
+
<button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button>
|
| 252 |
+
<pre class="vg-code-block">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.
|
| 255 |
|
| 256 |
STRICT ZERO-TOLERANCE CLASSIFICATION RULES:
|
| 257 |
|
| 258 |
+
1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.
|
| 259 |
|
| 260 |
+
2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.
|
| 261 |
|
| 262 |
3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.
|
| 263 |
|
| 264 |
+
4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.
|
| 265 |
|
| 266 |
+
5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.
|
| 267 |
|
| 268 |
+
6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.
|
| 269 |
|
| 270 |
7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.
|
| 271 |
|
|
|
|
| 280 |
"nsfw": 1 | 0,
|
| 281 |
"safe": 1 | 0
|
| 282 |
}</pre>
|
|
|
|
| 283 |
</div>
|
| 284 |
</details>
|
| 285 |
|
| 286 |
+
<div class="vg-section-title">Quick Start with Transformers</div>
|
| 287 |
+
|
| 288 |
<div class="vg-code-wrapper">
|
| 289 |
+
<div class="vg-code-label">bash</div>
|
| 290 |
+
<button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button>
|
| 291 |
+
<pre class="vg-code-block">pip install transformers
|
|
|
|
|
|
|
| 292 |
pip install accelerate</pre>
|
| 293 |
</div>
|
| 294 |
|
| 295 |
<div class="vg-code-wrapper">
|
| 296 |
+
<div class="vg-code-label">python</div>
|
| 297 |
+
<button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button>
|
| 298 |
+
<pre class="vg-code-block">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
|
|
|
|
|
|
|
| 299 |
import torch
|
| 300 |
|
| 301 |
model = Qwen3_5ForConditionalGeneration.from_pretrained(
|
|
|
|
| 349 |
print(output_text[0])</pre>
|
| 350 |
</div>
|
| 351 |
|
| 352 |
+
<div class="vg-section-title">Training Details</div>
|
| 353 |
+
<div class="vg-table-container">
|
| 354 |
+
<table class="vg-spec-table">
|
| 355 |
+
<tbody>
|
| 356 |
+
<tr><th>Setting</th><td>Value</td></tr>
|
| 357 |
+
<tr><th>Base Model</th><td>Qwen/Qwen3.5-4B</td></tr>
|
| 358 |
+
<tr><th>Model</th><td>VisionGuardrail-4B</td></tr>
|
| 359 |
+
<tr><th>Model Type</th><td>Multimodal Content-Safety Classifier</td></tr>
|
| 360 |
+
<tr><th>Training Dataset</th><td><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a></td></tr>
|
| 361 |
+
<tr><th>Training Objective</th><td>Content-safety guardrail classification</td></tr>
|
| 362 |
+
<tr><th>Primary Classification</th><td>Safe / Unsafe</td></tr>
|
| 363 |
+
<tr><th>Safety Focus</th><td>Not Safe for Work (NSFW) Sensual Content</td></tr>
|
| 364 |
+
<tr><th>Visual Analysis</th><td>Dress Codes, Poses, Exposure & Settings</td></tr>
|
| 365 |
+
<tr><th>Training Framework</th><td>TRL</td></tr>
|
| 366 |
+
</tbody>
|
| 367 |
+
</table>
|
| 368 |
+
</div>
|
| 369 |
+
|
| 370 |
+
<div class="vg-section-title">Intended Use</div>
|
| 371 |
+
<ul class="vg-plus-list">
|
| 372 |
<li><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</li>
|
| 373 |
<li><b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li>
|
| 374 |
<li><b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</li>
|
|
|
|
| 378 |
<li><b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li>
|
| 379 |
</ul>
|
| 380 |
|
| 381 |
+
<div class="vg-section-title">Limitations</div>
|
| 382 |
+
<ul class="vg-plus-list">
|
| 383 |
<li><b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</li>
|
| 384 |
<li><b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li>
|
| 385 |
<li><b>False Negatives</b>: Unsafe content may occasionally be missed.</li>
|
|
|
|
| 389 |
<li><b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</li>
|
| 390 |
</ul>
|
| 391 |
|
| 392 |
+
<div class="vg-section-title">Acknowledgements</div>
|
| 393 |
+
<div class="vg-ack-container">
|
| 394 |
+
<ul class="vg-plus-list">
|
| 395 |
+
<li><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-link" target="_blank" rel="noopener noreferrer">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</li>
|
| 396 |
+
<li><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</li>
|
| 397 |
+
<li><b>TRL</b> – <a href="https://huggingface.co/docs/trl/en/index" class="vg-link" target="_blank" rel="noopener noreferrer">Transformers Reinforcement Learning</a>: 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.</li>
|
| 398 |
+
<li><a href="https://huggingface.co/docs/transformers/en/index" class="vg-link" target="_blank" rel="noopener noreferrer">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.</li>
|
| 399 |
+
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
</div>
|
| 401 |
</div>
|
| 402 |
|
| 403 |
<script>
|
| 404 |
+
function vgCopyCode(btn) {
|
| 405 |
+
var wrapper = btn.closest('.vg-code-wrapper');
|
| 406 |
+
var codeElement = wrapper.querySelector('.vg-code-block');
|
| 407 |
+
var textToCopy = codeElement.innerText;
|
| 408 |
|
| 409 |
if (navigator.clipboard && window.isSecureContext) {
|
| 410 |
+
navigator.clipboard.writeText(textToCopy).then(function() {
|
| 411 |
+
showSuccess(btn);
|
| 412 |
}).catch(function() {
|
| 413 |
+
fallbackCopy(textToCopy, btn);
|
| 414 |
});
|
| 415 |
} else {
|
| 416 |
+
fallbackCopy(textToCopy, btn);
|
| 417 |
}
|
| 418 |
}
|
| 419 |
|
| 420 |
+
function fallbackCopy(text, btn) {
|
| 421 |
var textArea = document.createElement("textarea");
|
| 422 |
textArea.value = text;
|
| 423 |
textArea.style.position = "fixed";
|
|
|
|
| 428 |
textArea.select();
|
| 429 |
try {
|
| 430 |
document.execCommand('copy');
|
| 431 |
+
showSuccess(btn);
|
| 432 |
} catch (err) {
|
| 433 |
+
btn.innerText = "Error";
|
| 434 |
}
|
| 435 |
document.body.removeChild(textArea);
|
| 436 |
}
|
| 437 |
|
| 438 |
+
function showSuccess(btn) {
|
| 439 |
+
btn.innerText = "Copied!";
|
|
|
|
|
|
|
| 440 |
setTimeout(function() {
|
| 441 |
+
btn.innerText = "Copy";
|
|
|
|
| 442 |
}, 2000);
|
| 443 |
}
|
| 444 |
</script>
|