fix(mcp-image-gen): fix Heretic/FLUX2 integration bugs
- Fix syntax error in server.py (dangling docstring lines) - Correct model filename: flux-2-klein-4b.safetensors (without -fp8) - Fix _WORKFLOW_REGISTRY key to match actual downloaded filename - Update get_models() to always include registry models as fallback - Fix test expectations to match corrected model names - All 37 tests passing
This commit is contained in:
@@ -565,7 +565,56 @@ Then pass it back: `seed=3847291045`
|
||||
|
||||
---
|
||||
|
||||
## 10. Known Limitations
|
||||
## 10. FLUX.2 Klein 4B with Heretic Abliteration (New)
|
||||
|
||||
**New in this release:** Support for **FLUX.2 Klein 4B** using an **abliterated Qwen3-4B text encoder** via Heretic.
|
||||
|
||||
### Why Heretic?
|
||||
|
||||
FLUX.2 Klein uses a full LLM (Qwen3-4B) as its text encoder instead of CLIP+T5. This LLM has safety alignment that can refuse certain prompts. Heretic removes this alignment with **zero measurable KL divergence** (0.0000) and only 3/100 refusals.
|
||||
|
||||
### How to use it
|
||||
|
||||
```python
|
||||
generate_image(
|
||||
prompt="a beautiful cyberpunk fox in neon tokyo, highly detailed",
|
||||
model="flux-2-klein-4b-fp8.safetensors",
|
||||
width=1024,
|
||||
height=1024,
|
||||
steps=4
|
||||
)
|
||||
```
|
||||
|
||||
### Models to download
|
||||
|
||||
```bash
|
||||
# 1. FLUX.2 Klein 4B (distilled, fp8)
|
||||
huggingface-cli download black-forest-labs/FLUX.2-klein-4B \
|
||||
flux-2-klein-4b-fp8.safetensors \
|
||||
--local-dir ~/ComfyUI/models/diffusion_models/
|
||||
|
||||
# 2. FLUX.2 VAE
|
||||
huggingface-cli download black-forest-labs/FLUX.2-klein-4B \
|
||||
flux2-vae.safetensors \
|
||||
--local-dir ~/ComfyUI/models/vae/
|
||||
|
||||
# 3. Heretic-abliterated Qwen3-4B (from DreamFast)
|
||||
huggingface-cli download DreamFast/qwen3-4b-heretic \
|
||||
--local-dir /tmp/qwen3-heretic/
|
||||
cp /tmp/qwen3-heretic/model.safetensors \
|
||||
~/ComfyUI/models/text_encoders/qwen_3_4b_heretic.safetensors
|
||||
```
|
||||
|
||||
### Supported models (via `model=` parameter)
|
||||
|
||||
| Model | Description | VRAM | Speed | Censorship |
|
||||
|-------|-------------|------|-------|------------|
|
||||
| `flux1-schnell.safetensors` | Original (default) | ~8GB | Very fast | None |
|
||||
| `flux-2-klein-4b-fp8.safetensors` | **New** — with Heretic Qwen3-4B | ~12GB | Fast | **Removed** |
|
||||
|
||||
---
|
||||
|
||||
## 11. Known Limitations
|
||||
|
||||
### ComfyUI must run locally
|
||||
|
||||
|
||||
Reference in New Issue
Block a user