Instructions to use aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="aacudad/AnomalyThink-Qwen2.5-VL-7B-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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT") model = AutoModelForMultimodalLM.from_pretrained("aacudad/AnomalyThink-Qwen2.5-VL-7B-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?"} ] }, ] 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aacudad/AnomalyThink-Qwen2.5-VL-7B-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": "aacudad/AnomalyThink-Qwen2.5-VL-7B-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/aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT
- SGLang
How to use aacudad/AnomalyThink-Qwen2.5-VL-7B-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 "aacudad/AnomalyThink-Qwen2.5-VL-7B-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": "aacudad/AnomalyThink-Qwen2.5-VL-7B-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 "aacudad/AnomalyThink-Qwen2.5-VL-7B-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": "aacudad/AnomalyThink-Qwen2.5-VL-7B-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 aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT with Docker Model Runner:
docker model run hf.co/aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT
AnomalyThink-Qwen2.5-VL-7B-SFT
Supervised-fine-tuning-only baseline (DS-MVTec 80.16 / VisA 64.78).
A Qwen2.5-VL-7B model fine-tuned for explainable industrial anomaly detection (IAD). Given a product image it produces a structured reasoning trace (<think>), a defect <location> and <type> (for anomalies), and a binary <answer>. Research artefact from the MSc thesis Reasoning-Enhanced Vision-Language Models for Explainable Industrial Anomaly Detection (TU Delft, 2026).
Results (MMAD subsets, balanced accuracy)
| Benchmark | Balanced accuracy |
|---|---|
| DS-MVTec (1,670) | 80.16% |
| VisA (2,141) | 64.78% |
Evaluated under a single common harness on the MMAD DS-MVTec and VisA subsets. This is the SFT-only headline before any RL stage.
Training
Supervised fine-tuning on the AnomalyThink-6K corpus (6,000 Gemini-2.5-Flash traces, vision encoder frozen, epoch 3 of 4).
The "AnomalyThink" reasoning traces were distilled from Gemini 2.5-Flash on Real-IAD images. Training data: aacudad/AnomalyThink.
Usage
import torch
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
model = Qwen2_5_VLForConditionalGeneration.from_pretrained("aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT", torch_dtype=torch.bfloat16, device_map="auto")
processor = AutoProcessor.from_pretrained("aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT")
# Build the structured single-image IAD prompt + image, then generate.
Intended use and limitations
Research on explainable IAD. Known limitations: the model can confidently hallucinate a defect on a normal part (false positive), and GRPO-lineage variants can over-predict the "Missing Parts" type. As the public DS-MVTec/VisA images may appear in VLM pretraining, absolute numbers should be read with that caveat.
Citation
@mastersthesis{acudad2026anomalythink,
title = {Reasoning-Enhanced Vision-Language Models for Explainable Industrial Anomaly Detection},
author = {Acudad, Adnane},
school = {Delft University of Technology},
year = {2026}
}
License
Apache-2.0 (inherits the Qwen2.5-VL-7B base). Trained on Real-IAD (cite Real-IAD separately; images are not redistributed) with traces distilled from Gemini 2.5-Flash.
- Downloads last month
- -
Model tree for aacudad/AnomalyThink-Qwen2.5-VL-7B-SFT
Base model
Qwen/Qwen2.5-VL-7B-Instruct