Instructions to use sci4ai/Qwen2.5-VL-7B-Instruct-Ablit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sci4ai/Qwen2.5-VL-7B-Instruct-Ablit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="sci4ai/Qwen2.5-VL-7B-Instruct-Ablit") 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("sci4ai/Qwen2.5-VL-7B-Instruct-Ablit") model = AutoModelForMultimodalLM.from_pretrained("sci4ai/Qwen2.5-VL-7B-Instruct-Ablit") 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 sci4ai/Qwen2.5-VL-7B-Instruct-Ablit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit", "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/sci4ai/Qwen2.5-VL-7B-Instruct-Ablit
- SGLang
How to use sci4ai/Qwen2.5-VL-7B-Instruct-Ablit 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 "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit" \ --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": "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit", "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 "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit" \ --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": "sci4ai/Qwen2.5-VL-7B-Instruct-Ablit", "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 sci4ai/Qwen2.5-VL-7B-Instruct-Ablit with Docker Model Runner:
docker model run hf.co/sci4ai/Qwen2.5-VL-7B-Instruct-Ablit
Qwen2.5-VL-7B-Instruct-Ablit (Abliterated Qwen-Image-2512 Text-Encoder)
|
Abliterated Qwen2.5-VL-7B-Instruct β full-precision BF16 safetensors. This is a vision-language model with refusal directions removed, enabling uncensored text generation while preserving multimodal capabilities. Image Generation Use Case: Qwen2.5-VL-7B-Instruct is the text encoder for Qwen-Image-2512. This abliterated version provides a drop-in replacement for uncensored image generation workflows in ComfyUI and other diffusion tooling. |
Usage
from transformers import AutoModelForImageTextToText, AutoTokenizer
model = AutoModelForImageTextToText.from_pretrained(
"Ablit-Qwen2.5-VL-7B-Instruct",
dtype="bfloat16",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Ablit-Qwen2.5-VL-7B-Instruct")
The base chat template (Qwen2-VL) is unchanged. This model retains the vision tower from the base model and can process both text and images.
Abliteration Method
AblitVL β an adaptation of the AblitMD project for vision-language models.
Try it out: Roll your own recipe with the all-in-one app at ablitVL (adaptation of ablitMD for vision-language models).
This build uses the classic heretic-style single-direction abliteration method rather than the multi-category approach used in ablitMD. The motivation is simplicity and compatibility with vision-language architectures.
Heretic-Style Single Direction
Direction computation β A single refusal direction is computed per layer using hidden states from the final token in the residual stream.
- Harmful prompts: A curated set of text-only harmful requests
- Harmless prompts: A matching set of benign requests
Each prompt was run through the base model and the hidden states at the final token were captured per layer. Every response was then classified by refusal type (
hard/redirect/none), and each classification was reviewed for accuracy before the activations fed into the direction computation.Single merged direction β Rather than maintaining separate per-category directions, the refusal direction is computed as the normalized difference between the mean of all refusal activations (hard + redirect) and the mean of all non-refusal activations (none).
refusal_mean = mean(hard_states + redirect_states) complied_mean = mean(none_states) direction = normalize(refusal_mean - complied_mean)Weight orthogonalization β The refusal direction is ablated from the model weights using orthogonal projection:
- For attention/MLP projection weights:
W' = W - factor * (direction β (direction^T @ W)) - For lm_head:
W' = W - factor * ((W @ direction) β direction^T)
The ablation is applied to every decoder layer (1β27) and the lm_head at a uniform factor across all layers.
- For attention/MLP projection weights:
Why Single Direction for VL Models?
The heretic-style approach was chosen for this VL adaptation because:
- Simplicity β Vision-language models have more complex architectures; a single direction reduces the ablation surface area and potential interactions with the vision tower.
- Text-only abliteration β Refusal primarily manifests in the text decoder; the vision encoder is unaffected.
- Sufficient for VL use cases β The single-direction approach has proven effective for text models, and VL refusal patterns follow similar geometry.
Notes & Limitations
- Abliteration is not alignment removal or capability addition. It suppresses the refusal direction; it does not add knowledge or skills the base model lacks, and it can occasionally weaken instruction-following near the edited layers.
- Vision capabilities preserved β The vision tower is unchanged; image understanding and multimodal reasoning remain intact.
- Responsibility: Removing refusals shifts the safety burden entirely onto the deployer. Use within your own policy.
Attribution
- Base weights: Qwen team (
Qwen/Qwen2.5-VL-7B-Instruct). - Refusal-direction abliteration builds on the "refusal is mediated by a direction" line of interpretability work.
- Heretic-style single-direction method: adapted for VL from classic abliteration techniques.
- AblitVL implementation: eric-merritt (adaptation of ablitMD for vision-language models).
- Downloads last month
- 23
Model tree for sci4ai/Qwen2.5-VL-7B-Instruct-Ablit
Base model
Qwen/Qwen2.5-VL-7B-Instruct