File size: 4,991 Bytes
f717400
 
 
 
 
 
 
 
 
 
 
 
 
 
250e708
f717400
 
 
 
 
 
 
bd6e920
f717400
 
 
 
 
 
 
f291425
f717400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f291425
f717400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea863d1
f717400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
license: creativeml-openrail-m
tags:
- text-to-image
- stable-diffusion
- anima
- cosmos
- anime
- illustration
- custom-mix
library_name: comfyui
inference: false
---

# DreamCoil-Anima

This is a custom fine-tuned hybrid of the **Anima 2B** text-to-image model (based on the NVIDIA Cosmos architecture). It combines the high-quality anime illustration capabilities of Anima with a custom aesthetic mix from Civitai, delivering rich, painterly, and detailed digital artwork.

## 🎨 Showcase

Generated with this model:

![DreamCoil-Anima Sample](sample.png)

---

## 🧩 Model Components

To use this hybrid, you need all three split components (which are already packed in this repository):

1. **Diffusion Model (UNET):** `models/diffusion_models/dreamcoil-anima.safetensors` (Custom Civitai Fine-tune)
2. **Text Encoder (CLIP):** `models/text_encoders/qwen_3_06b_base.safetensors` (Qwen 0.6B)
3. **VAE:** `models/vae/qwen_image_vae.safetensors` (Qwen VAE)

---

## 💻 How to Run (One-Click Python Execution)

You can run this model in headless mode directly. The script below will automatically clone ComfyUI, download all required model files directly from this Hugging Face repository, and generate the image without any web GUI.

```python
import os
import sys
import subprocess

# 1. Setup ComfyUI and requirements
if not os.path.exists("ComfyUI"):
    print("Cloning ComfyUI...")
    subprocess.run(["git", "clone", "https://github.com/comfyanonymous/ComfyUI.git"])
    subprocess.run([sys.executable, "-m", "pip", "install", "-r", "ComfyUI/requirements.txt"])
    subprocess.run([sys.executable, "-m", "pip", "install", "huggingface_hub", "torch", "numpy", "Pillow"])

sys.path.append("./ComfyUI")

# 2. Download all components from this HF Repo
from huggingface_hub import hf_hub_download


REPO_ID = "EngineerGL/DreamCoil-Anima" 

print("Downloading model files from Hugging Face...")
# This will recreate the correct folder structure inside ComfyUI/models/
hf_hub_download(repo_id=REPO_ID, filename="diffusion_models/dreamcoil-anima.safetensors", local_dir="./ComfyUI/models")
hf_hub_download(repo_id=REPO_ID, filename="text_encoders/qwen_3_06b_base.safetensors", local_dir="./ComfyUI/models")
hf_hub_download(repo_id=REPO_ID, filename="vae/qwen_image_vae.safetensors", local_dir="./ComfyUI/models")

# 3. Import ComfyUI nodes
import torch
import numpy as np
from PIL import Image
from nodes import NODE_CLASS_MAPPINGS
import folder_paths

# Register folders explicitly to avoid any lookup issues
folder_paths.add_model_folder_path("clip", "./ComfyUI/models/text_encoders")
folder_paths.add_model_folder_path("vae", "./ComfyUI/models/vae")
folder_paths.add_model_folder_path("unet", "./ComfyUI/models/diffusion_models")

UNETLoader = NODE_CLASS_MAPPINGS["UNETLoader"]()
CLIPLoader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
VAELoader = NODE_CLASS_MAPPINGS["VAELoader"]()
CLIPTextEncode = NODE_CLASS_MAPPINGS["CLIPTextEncode"]()
KSampler = NODE_CLASS_MAPPINGS["KSampler"]()
VAEDecode = NODE_CLASS_MAPPINGS["VAEDecode"]()
EmptyLatentImage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()

print("Loading weights into memory...")
with torch.inference_mode():
    unet = UNETLoader.load_unet("dreamcoil-anima.safetensors", "default")[0]
    
    # Try using 'cosmos' type for Cosmos-based Qwen text encoder
    try:
        clip = CLIPLoader.load_clip("qwen_3_06b_base.safetensors", type="cosmos")[0]
    except Exception:
        clip = CLIPLoader.load_clip("qwen_3_06b_base.safetensors")[0]
        
    vae = VAELoader.load_vae("qwen_image_vae.safetensors")[0]

# 4. Generate Image
@torch.inference_mode()
def generate(positive_prompt, negative_prompt, seed=42):
    print("Generating...")
    positive = CLIPTextEncode.encode(clip, positive_prompt)[0]
    negative = CLIPTextEncode.encode(clip, negative_prompt)[0]
    latent = EmptyLatentImage.generate(1024, 1024, batch_size=1)[0]
    
    samples = KSampler.sample(
        unet, seed=seed, steps=25, cfg=5.0, 
        sampler_name="euler", scheduler="normal", 
        positive=positive, negative=negative, latent_image=latent
    )[0]
    
    decoded = VAEDecode.decode(vae, samples)[0].detach()
    img_array = np.array(decoded * 255, dtype=np.uint8)[0]
    
    output_path = "output_anima.png"
    Image.fromarray(img_array).save(output_path)
    print(f"Done! Image saved as {output_path}")

prompt = "masterpiece, best quality, score_9, 1girl, solo, @wlop, cyberpunk city, neon lights"
negative_prompt = "blurry, ugly, low quality, score_1, score_2"

generate(prompt, negative_prompt, seed=42)
```
---

## 👥 Credits & Attribution

* **Fine-Tuning & Custom Assembly:** Created by **[Kate-Katie07](https://huggingface.co/Kate-Katie07)**.
* **Base Architecture:** Developed by **NVIDIA (Cosmos)**.
* **Base Text-to-Image Model:** **Anima 2B** by **CircleStone Labs & ComfyOrg**.

If you use this model or its outputs in your work, please consider giving a star to the repository and giving credit to the creators!

---