Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
ncii-detection
visual-safety
qwen3.5
multimodal-content-filter
conversational
Run this model with HF Jobs
Run prithivMLmods/ImageShield-MMCF-2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/prithivMLmods/ImageShield-MMCF-2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/prithivMLmods/ImageShield-MMCF-2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/prithivMLmods/ImageShield-MMCF-2B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/prithivMLmods/ImageShield-MMCF-2B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use prithivMLmods/ImageShield-MMCF-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/ImageShield-MMCF-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/ImageShield-MMCF-2B") 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/ImageShield-MMCF-2B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/ImageShield-MMCF-2B", 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/ImageShield-MMCF-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/ImageShield-MMCF-2B" # 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/ImageShield-MMCF-2B", "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/ImageShield-MMCF-2B
- SGLang
How to use prithivMLmods/ImageShield-MMCF-2B 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/ImageShield-MMCF-2B" \ --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/ImageShield-MMCF-2B", "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/ImageShield-MMCF-2B" \ --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/ImageShield-MMCF-2B", "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/ImageShield-MMCF-2B with Docker Model Runner:
docker model run hf.co/prithivMLmods/ImageShield-MMCF-2B
Update README.md
Browse files11 unmodified lines1213141511 unmodified lines- text-generation-inference---## ImageShield-MMCF — Multimodal Content Filter11 unmodified lines1213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216311 unmodified lines- text-generation-inference---# **[ImageShield-MMCF-2B](https://huggingface.co/prithivMLmods/ImageShield-MMCF-2B)**> **ImageShield-MMCF — Multimodal Content Filter** is a multimodal content-safety classifier built on top of **Qwen/Qwen3.5-2B** and trained on approximately **28,000 content-safety guardrail samples**. The model is designed to classify visual content as **Safe** or **Unsafe**, with a particular focus on detecting **Non-Consensual Intimate Imagery (NCII)** and other potentially sensitive visual content.> [!NOTE]>> **This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios.**> [!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.5 Foundation**: Built on top of **Qwen/Qwen3.5-2B**.* **Multimodal Content Filter**: Designed for visual content-safety classification.* **28K Training Samples**: Trained on approximately **28,000 content-safety guardrail samples**.* **Safe / Unsafe Classification**: Classifies visual content as either **Safe** or **Unsafe**.* **NCII Detection**: Focused on identifying potentially **Non-Consensual Intimate Imagery (NCII)** and related sensitive visual content.* **Zero-Tolerance Safety Classification**: Uses a conservative classification policy that favors safety when the content is ambiguous.* **Structured Output**: Produces a machine-readable JSON response containing a caption, classification, and reasoning.## **Standard Instruction**```textYou are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.STRICT ZERO-TOLERANCE CLASSIFICATION RULES:1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.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.3. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.4. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.5. Classification Threshold: When in doubt, err on the side of caution and classify the content as NSFW.Output strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:{"caption": "<Detailed, objective visual description of the subject, clothing, exposure, and pose>","is_nsfw": true | false,"reason": "<Precise reason for classification based on clothing, exposure, or pose>","nsfw": 1 | 0,"safe": 1 | 0}```## **Quick Start with Transformers**```bashpip install transformerspip install accelerate``````pythonfrom transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained("prithivMLmods/ImageShield-MMCF-2B",torch_dtype="auto",device_map="auto")processor = AutoProcessor.from_pretrained("prithivMLmods/ImageShield-MMCF-2B")messages = [{"role": "user","content": [{"type": "text","text": "Classify this image using the provided content-safety guardrail."}],}]text = processor.apply_chat_template(messages,tokenize=False,add_generation_prompt=True)inputs = processor(text=[text],padding=True,return_tensors="pt").to("cuda")generated_ids = model.generate(**inputs,max_new_tokens=256)output_text = processor.batch_decode([out[len(inp):]for inp, out in zip(inputs.input_ids, generated_ids)],skip_special_tokens=True,clean_up_tokenization_spaces=False)print(output_text[0])```## **Training Details**| Setting | Value || :------------------------- | :----------------------------------------- || **Base Model** | **Qwen/Qwen3.5-2B** || **Model Type** | **Multimodal Content-Safety Classifier** || **Training Samples** | Approximately **28,000** || **Training Objective** | Content-safety guardrail classification || **Primary Classification** | **Safe / Unsafe** || **Safety Focus** | **Non-Consensual Intimate Imagery (NCII)** || **Training Framework** | **TRL** |## **Intended Use*** **Content Safety Classification**: Classifying visual media as safe or unsafe.* **NCII Detection**: Supporting research into automated detection of potentially non-consensual intimate imagery.* **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.## **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.* **Automated Classification**: The model should not be treated as a definitive legal or safety determination.## **Acknowledgements*** **[Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B)**: Base multimodal model used for this project.* **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.
README.md+149-1