prithivMLmods commited on
Commit
dc14615
·
verified ·
1 Parent(s): 15d3876

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -207
README.md CHANGED
@@ -1,207 +0,0 @@
1
- ---
2
- license: apache-2.0
3
- base_model:
4
- - Qwen/Qwen3.5-4B
5
- ---
6
-
7
- <div style="font-family: 'Ubuntu', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background-color: #000000; color: #FFFFFF; padding: 25px; border-radius: 8px; max-width: 900px; margin: 0 auto; line-height: 1.6;">
8
- <style>
9
- .vg-link { color: #FF4500; text-decoration: none; font-weight: bold; }
10
- .vg-link:hover { text-decoration: underline; }
11
- .vg-bullet { list-style-type: none; padding-left: 20px; }
12
- .vg-bullet li { margin-bottom: 10px; position: relative; padding-left: 20px; }
13
- .vg-bullet li::before { content: "+"; position: absolute; left: 0; color: #FFFFFF; font-weight: bold; }
14
- .vg-code-container { position: relative; background-color: #111111; border: 1px solid #333333; border-radius: 4px; margin-bottom: 15px; }
15
- .vg-copy-btn { position: absolute; top: 8px; right: 8px; background-color: #333333; color: #FFFFFF; border: 1px solid #555555; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-family: 'Ubuntu', sans-serif; font-size: 12px; transition: background 0.2s; z-index: 10; }
16
- .vg-copy-btn:hover { background-color: #555555; }
17
- .vg-code { padding: 40px 15px 15px 15px; overflow-x: auto; color: #FFFFFF; font-family: 'Ubuntu Mono', 'Courier New', monospace; font-size: 14px; white-space: pre; }
18
- .vg-boxquote { border: 1px solid #FFFFFF; padding: 15px; margin: 20px 0; border-radius: 4px; background-color: #000000; color: #FFFFFF; }
19
- .vg-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
20
- .vg-table th, .vg-table td { border: 1px solid #444444; padding: 10px; text-align: left; color: #FFFFFF; }
21
- .vg-table th { background-color: #111111; font-weight: bold; }
22
- </style>
23
-
24
- <h1 style="color: #FFFFFF; font-weight: bold; font-size: 28px; border-bottom: 2px solid #444444; padding-bottom: 10px; margin-top: 0;">VisionGuardrail-4B</h1>
25
-
26
- <p style="font-size: 16px; color: #FFFFFF;">
27
- <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">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.
28
- </p>
29
-
30
- <div class="vg-boxquote">
31
- 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.
32
- </div>
33
-
34
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Key Highlights</h2>
35
- <ul class="vg-bullet">
36
- <li><b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</li>
37
- <li><b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</li>
38
- <li><b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <b>prithivMLmods/ImageShield-Guardrail-Pro</b> content-safety guardrail dataset.</li>
39
- <li><b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</li>
40
- <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>
41
- <li><b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li>
42
- <li><b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li>
43
- <li><b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li>
44
- <li><b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</li>
45
- <li><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li>
46
- <li><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li>
47
- </ul>
48
-
49
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Standard Instruction</h2>
50
-
51
- <div class="vg-code-container">
52
- <button class="vg-copy-btn" onclick="copyCode(this)">Copy</button>
53
- <pre class="vg-code"><code>You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.
54
-
55
- Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.
56
-
57
- STRICT ZERO-TOLERANCE CLASSIFICATION RULES:
58
-
59
- 1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.
60
-
61
- 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.
62
-
63
- 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.
64
-
65
- 4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.
66
-
67
- 5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.
68
-
69
- 6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.
70
-
71
- 7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.
72
-
73
- 8. Classification Threshold: When in doubt, err on the side of caution and classify the content as NSFW.
74
-
75
- Output strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:
76
-
77
- {
78
- "caption": "<Detailed, objective visual description of the subject, clothing, exposure, pose, and setting>",
79
- "is_nsfw": true | false,
80
- "reason": "<Precise reason for classification based on clothing, exposure, pose, context, or other visual cues>",
81
- "nsfw": 1 | 0,
82
- "safe": 1 | 0
83
- }</code></pre>
84
- </div>
85
-
86
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Quick Start with Transformers</h2>
87
-
88
- <div class="vg-code-container">
89
- <button class="vg-copy-btn" onclick="copyCode(this)">Copy</button>
90
- <pre class="vg-code"><code>pip install transformers
91
- pip install accelerate</code></pre>
92
- </div>
93
-
94
- <div class="vg-code-container">
95
- <button class="vg-copy-btn" onclick="copyCode(this)">Copy</button>
96
- <pre class="vg-code"><code>from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
97
- import torch
98
-
99
- model = Qwen3_5ForConditionalGeneration.from_pretrained(
100
- "prithivMLmods/VisionGuardrail-4B",
101
- torch_dtype="auto",
102
- device_map="auto"
103
- )
104
-
105
- processor = AutoProcessor.from_pretrained(
106
- "prithivMLmods/VisionGuardrail-4B"
107
- )
108
-
109
- messages = [
110
- {
111
- "role": "user",
112
- "content": [
113
- {
114
- "type": "text",
115
- "text": "Classify this image using the provided content-safety guardrail."
116
- }
117
- ],
118
- }
119
- ]
120
-
121
- text = processor.apply_chat_template(
122
- messages,
123
- tokenize=False,
124
- add_generation_prompt=True
125
- )
126
-
127
- inputs = processor(
128
- text=[text],
129
- padding=True,
130
- return_tensors="pt"
131
- ).to("cuda")
132
-
133
- generated_ids = model.generate(
134
- **inputs,
135
- max_new_tokens=256
136
- )
137
-
138
- output_text = processor.batch_decode(
139
- [
140
- out[len(inp):]
141
- for inp, out in zip(inputs.input_ids, generated_ids)
142
- ],
143
- skip_special_tokens=True,
144
- clean_up_tokenization_spaces=False
145
- )
146
-
147
- print(output_text[0])</code></pre>
148
- </div>
149
-
150
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Training Details</h2>
151
- <table class="vg-table">
152
- <tr><th>Setting</th><th>Value</th></tr>
153
- <tr><td><b>Base Model</b></td><td><b>Qwen/Qwen3.5-4B</b></td></tr>
154
- <tr><td><b>Model</b></td><td><b>VisionGuardrail-4B</b></td></tr>
155
- <tr><td><b>Model Type</b></td><td><b>Multimodal Content-Safety Classifier</b></td></tr>
156
- <tr><td><b>Training Dataset</b></td><td><b>prithivMLmods/ImageShield-Guardrail-Pro</b></td></tr>
157
- <tr><td><b>Training Objective</b></td><td><b>Content-safety guardrail classification</b></td></tr>
158
- <tr><td><b>Primary Classification</b></td><td><b>Safe / Unsafe</b></td></tr>
159
- <tr><td><b>Safety Focus</b></td><td><b>Not Safe for Work (NSFW) Sensual Content</b></td></tr>
160
- <tr><td><b>Visual Analysis</b></td><td><b>Dress Codes, Poses, Exposure & Settings</b></td></tr>
161
- <tr><td><b>Training Framework</b></td><td><b>TRL</b></td></tr>
162
- </table>
163
-
164
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Intended Use</h2>
165
- <ul class="vg-bullet">
166
- <li><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</li>
167
- <li><b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li>
168
- <li><b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</li>
169
- <li><b>Content Moderation</b>: Supporting automated safety classification pipelines.</li>
170
- <li><b>Multimodal Safety Research</b>: Evaluating content-safety behavior in multimodal language models.</li>
171
- <li><b>Guardrail Development</b>: Researching structured safety classification and filtering workflows.</li>
172
- <li><b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li>
173
- </ul>
174
-
175
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Limitations</h2>
176
- <ul class="vg-bullet">
177
- <li><b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</li>
178
- <li><b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li>
179
- <li><b>False Negatives</b>: Unsafe content may occasionally be missed.</li>
180
- <li><b>Context Sensitivity</b>: Classification performance depends on image quality, visual context, and the provided instruction.</li>
181
- <li><b>Conservative Policy</b>: The model intentionally uses a strict classification threshold and may flag content that would not be considered NSFW under less restrictive moderation policies.</li>
182
- <li><b>Visual Ambiguity</b>: Clothing, poses, artistic styles, and contextual cues may sometimes be difficult to interpret accurately.</li>
183
- <li><b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</li>
184
- </ul>
185
-
186
- <h2 style="color: #FFFFFF; font-size: 22px; font-weight: bold; border-bottom: 1px solid #444444; padding-bottom: 5px;">Acknowledgements</h2>
187
- <ul class="vg-bullet">
188
- <li><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-link">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</li>
189
- <li><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</li>
190
- <li><b>TRL</b> – <a href="https://huggingface.co/docs/trl/en/index" class="vg-link">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>
191
- <li><a href="https://huggingface.co/docs/transformers/en/index" class="vg-link">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>
192
- </ul>
193
- </div>
194
-
195
- <script>
196
- function copyCode(btn) {
197
- const codeBlock = btn.nextElementSibling.querySelector('code');
198
- const textArea = document.createElement('textarea');
199
- textArea.value = codeBlock.innerText;
200
- document.body.appendChild(textArea);
201
- textArea.select();
202
- document.execCommand('copy');
203
- document.body.removeChild(textArea);
204
- btn.innerText = 'Copied!';
205
- setTimeout(() => { btn.innerText = 'Copy'; }, 2000);
206
- }
207
- </script>