Image-Text-to-Text
Transformers
Safetensors
qwen3_5
heretic
uncensored
abliterated
moss-image
text-encoder
prompt-enhancer
qwen3.5
conversational
Instructions to use pottokao/MOSS-Image-Text-Encoder-Heretic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pottokao/MOSS-Image-Text-Encoder-Heretic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="pottokao/MOSS-Image-Text-Encoder-Heretic") 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("pottokao/MOSS-Image-Text-Encoder-Heretic") model = AutoModelForMultimodalLM.from_pretrained("pottokao/MOSS-Image-Text-Encoder-Heretic", 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 pottokao/MOSS-Image-Text-Encoder-Heretic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pottokao/MOSS-Image-Text-Encoder-Heretic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pottokao/MOSS-Image-Text-Encoder-Heretic", "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/pottokao/MOSS-Image-Text-Encoder-Heretic
- SGLang
How to use pottokao/MOSS-Image-Text-Encoder-Heretic 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 "pottokao/MOSS-Image-Text-Encoder-Heretic" \ --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": "pottokao/MOSS-Image-Text-Encoder-Heretic", "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 "pottokao/MOSS-Image-Text-Encoder-Heretic" \ --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": "pottokao/MOSS-Image-Text-Encoder-Heretic", "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 pottokao/MOSS-Image-Text-Encoder-Heretic with Docker Model Runner:
docker model run hf.co/pottokao/MOSS-Image-Text-Encoder-Heretic
|
Download README.md from pottokao/MOSS-Image-Text-Encoder-Heretic: direct link, hf CLI and curl.
- Browser
- Download file 4.41 kB
-
https://huggingface.co/pottokao/MOSS-Image-Text-Encoder-Heretic/resolve/main/README.md
- Command line
-
hf download hf://pottokao/MOSS-Image-Text-Encoder-Heretic/README.md
-
curl -L -o README.md https://huggingface.co/pottokao/MOSS-Image-Text-Encoder-Heretic/resolve/main/README.md
4.41 kB
| license: apache-2.0 | |
| base_model: | |
| - Qwen/Qwen3.5-9B | |
| base_model_relation: finetune | |
| pipeline_tag: image-text-to-text | |
| library_name: transformers | |
| tags: | |
| - heretic | |
| - uncensored | |
| - abliterated | |
| - moss-image | |
| - text-encoder | |
| - prompt-enhancer | |
| - qwen3.5 | |
| # MOSS-Image Text Encoder — Heretic (Qwen3.5-9B) | |
| A decensored **Qwen3.5-9B**, made to be the text encoder *and* the prompt enhancer of | |
| [MOSS-Image](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT). | |
| MOSS-Image's text encoder is the stock `Qwen/Qwen3.5-9B` — we checked: its weights are | |
| byte-identical to the official release (only `lm_head` and the MTP head are left out). Because the | |
| encoder is a complete chat model, one copy can both **rewrite** a short idea into a full caption and | |
| then **encode** that caption for the DiT. The official ComfyUI MOSS-Image template already does this | |
| with a w4a8 copy. The stock model, however, refuses or quietly softens many adult requests, and in that | |
| setup the refusal text itself gets encoded and rendered. | |
| This repo is the same model with refusals removed by [Heretic](https://github.com/p-e-w/heretic) | |
| (ARA modifier), merged into the weights. Everything else is untouched. | |
| ## What changed | |
| - Only **32 tensors** differ from `Qwen/Qwen3.5-9B`: `mlp.down_proj`, `linear_attn.out_proj` and | |
| `self_attn.o_proj` in decoder layers 15–31 (median relative change 11%). | |
| - Every other tensor is **bit-identical** to the original, including `lm_head`, the **MTP head** | |
| (usable for speculative decoding) and the **vision tower**. | |
| - `heretic_merge_info.json` lists every changed tensor and its relative change. | |
| ## Numbers | |
| Measured with thinking **off** (`<think></think>` prefix), which is how a prompt enhancer runs. | |
| | | Refusals (Heretic, 100 prompts) | KL vs original (first token) | | |
| |---|---|---| | |
| | Qwen3.5-9B | 100/100 | 0 | | |
| | **This model** | 2/100 | 0.050 | | |
| Keyword counts can be gamed by off-topic answers, so we also had **gemma-4-12b** judge 60 answers from | |
| `mlabonne/harmful_behaviors` (greedy, thinking off, up to 1024 tokens): | |
| | | Full | Partial | Deflect | Refuse | | |
| |---|---|---|---|---| | |
| | Qwen3.5-9B | 0 | 0 | 8 | 52 | | |
| | **This model** | 37 | 1 | 19 | 3 | | |
| As a MOSS-Image prompt enhancer (official Prompt Enhancer skill as the system prompt, 10 explicit | |
| adult-sex requests, thinking off): the stock model refused **6/10**; this model refused **0/10**. | |
| ## INT8 for ComfyUI | |
| Two INT8 files in [`int8/`](./int8), in ComfyUI's native `int8_tensorwise` + ConvRot format | |
| (same layout as Comfy-Org's Qwen3.5-9B files; loads with the stock **Load CLIP** node, type `moss_image`): | |
| | File | Size | Contents | Use | | |
| |---|---|---|---| | |
| | `int8/moss_te_heretic_full_int8_convrot.safetensors` | 9.75 GB | everything (lm_head, MTP, vision tower) | text encoder **and** prompt enhancer (TextGenerate) | | |
| | `int8/moss_te_heretic_te_int8_convrot.safetensors` | 7.95 GB | language model only | text encoder only (cannot generate text) | | |
| Both encode identically. Measured in ComfyUI against this repo's BF16 on 36 held-out captions: | |
| mean relative error **2.75%** (max 5.6%), cosine >= **0.9988**. The full file's prompt enhancement was | |
| checked to produce normal text. Images were not A/B-tested for INT8 (lower-bit GGUFs already looked the same). | |
| Smaller files: [MOSS-Image-Text-Encoder-Heretic-DHQ-GGUF](https://huggingface.co/pottokao/MOSS-Image-Text-Encoder-Heretic-DHQ-GGUF) (down to ~3 GB). | |
| ## Caveats | |
| - Thinking **on** was not measured. Use it with thinking off, as a prompt enhancer does. | |
| - The merged weights shift the encoder slightly. If you only need encoding, the stock encoder is | |
| the reference; we are still comparing images from both. | |
| - 19/60 judged answers still deflect. Prompts may occasionally be softened. | |
| ## Search | |
| Distributed Heretic search (3 machines, ~4.5 h, 3 automatic search-box adjustments, 413 trials). | |
| Selected trial: refusals 1/100 @ KL 0.048 in search, chosen over a 0/100 trial whose low count came | |
| mostly from off-topic answers (judge: 18 full / 39 deflect). | |
| Parameters: start layer 15, end layer 31, preserve weight 0.392, steer weight 4.1e-4, | |
| overcorrect 0.988, neighbors 10, LoRA rank 50 (merged at scale 1.0). | |
| ## Use responsibly | |
| Adults only. Do not use this to depict minors or age-ambiguous people, non-consensual acts, or real | |
| people without their consent. You are responsible for complying with the law where you live. | |
| ## License | |
| Apache-2.0, same as Qwen3.5-9B. | |