DreamCoil-Anima / README.md
Kate-katie07's picture
Update README.md
250e708 verified
---
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!
---