Kate-katie07 commited on
Commit
f717400
·
verified ·
1 Parent(s): 1699aa5

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +138 -0
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: creativeml-openrail-m
3
+ tags:
4
+ - text-to-image
5
+ - stable-diffusion
6
+ - anima
7
+ - cosmos
8
+ - anime
9
+ - illustration
10
+ - custom-mix
11
+ library_name: comfyui
12
+ inference: false
13
+ ---
14
+
15
+ # Anima 2B Custom Hybrid
16
+
17
+ 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.
18
+
19
+ ## 🎨 Showcase
20
+
21
+ Generated with this model:
22
+
23
+ ![Anima 2B Hybrid Sample](sample.png)
24
+
25
+ *Prompt:* `masterpiece, best quality, score_9, 1girl, solo, looking at viewer, @wlop, cyberpunk city background, neon lights, highly detailed`
26
+ *Settings:* Steps: 25, CFG: 5.0, Sampler: Euler, Scheduler: Normal, Resolution: 1024x1024 (aspect ratio adjusted)
27
+
28
+ ---
29
+
30
+ ## 🧩 Model Components
31
+
32
+ To use this hybrid, you need all three split components (which are already packed in this repository):
33
+
34
+ 1. **Diffusion Model (UNET):** `models/diffusion_models/anima_custom_mix.safetensors` (Custom Civitai Fine-tune)
35
+ 2. **Text Encoder (CLIP):** `models/text_encoders/qwen_3_06b_base.safetensors` (Qwen 0.6B)
36
+ 3. **VAE:** `models/vae/qwen_image_vae.safetensors` (Qwen VAE)
37
+
38
+ ---
39
+
40
+ ## 💻 How to Run (One-Click Python Execution)
41
+
42
+ 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.
43
+
44
+ ```python
45
+ import os
46
+ import sys
47
+ import subprocess
48
+
49
+ # 1. Setup ComfyUI and requirements
50
+ if not os.path.exists("ComfyUI"):
51
+ print("Cloning ComfyUI...")
52
+ subprocess.run(["git", "clone", "https://github.com/comfyanonymous/ComfyUI.git"])
53
+ subprocess.run([sys.executable, "-m", "pip", "install", "-r", "ComfyUI/requirements.txt"])
54
+ subprocess.run([sys.executable, "-m", "pip", "install", "huggingface_hub", "torch", "numpy", "Pillow"])
55
+
56
+ sys.path.append("./ComfyUI")
57
+
58
+ # 2. Download all components from this HF Repo
59
+ from huggingface_hub import hf_hub_download
60
+
61
+
62
+ REPO_ID = "EngineerGL/DreamCoil-Anima"
63
+
64
+ print("Downloading model files from Hugging Face...")
65
+ # This will recreate the correct folder structure inside ComfyUI/models/
66
+ hf_hub_download(repo_id=REPO_ID, filename="diffusion_models/anima_custom_mix.safetensors", local_dir="./ComfyUI/models")
67
+ hf_hub_download(repo_id=REPO_ID, filename="text_encoders/qwen_3_06b_base.safetensors", local_dir="./ComfyUI/models")
68
+ hf_hub_download(repo_id=REPO_ID, filename="vae/qwen_image_vae.safetensors", local_dir="./ComfyUI/models")
69
+
70
+ # 3. Import ComfyUI nodes
71
+ import torch
72
+ import numpy as np
73
+ from PIL import Image
74
+ from nodes import NODE_CLASS_MAPPINGS
75
+ import folder_paths
76
+
77
+ # Register folders explicitly to avoid any lookup issues
78
+ folder_paths.add_model_folder_path("clip", "./ComfyUI/models/text_encoders")
79
+ folder_paths.add_model_folder_path("vae", "./ComfyUI/models/vae")
80
+ folder_paths.add_model_folder_path("unet", "./ComfyUI/models/diffusion_models")
81
+
82
+ UNETLoader = NODE_CLASS_MAPPINGS["UNETLoader"]()
83
+ CLIPLoader = NODE_CLASS_MAPPINGS["CLIPLoader"]()
84
+ VAELoader = NODE_CLASS_MAPPINGS["VAELoader"]()
85
+ CLIPTextEncode = NODE_CLASS_MAPPINGS["CLIPTextEncode"]()
86
+ KSampler = NODE_CLASS_MAPPINGS["KSampler"]()
87
+ VAEDecode = NODE_CLASS_MAPPINGS["VAEDecode"]()
88
+ EmptyLatentImage = NODE_CLASS_MAPPINGS["EmptyLatentImage"]()
89
+
90
+ print("Loading weights into memory...")
91
+ with torch.inference_mode():
92
+ unet = UNETLoader.load_unet("anima_custom_mix.safetensors", "default")[0]
93
+
94
+ # Try using 'cosmos' type for Cosmos-based Qwen text encoder
95
+ try:
96
+ clip = CLIPLoader.load_clip("qwen_3_06b_base.safetensors", type="cosmos")[0]
97
+ except Exception:
98
+ clip = CLIPLoader.load_clip("qwen_3_06b_base.safetensors")[0]
99
+
100
+ vae = VAELoader.load_vae("qwen_image_vae.safetensors")[0]
101
+
102
+ # 4. Generate Image
103
+ @torch.inference_mode()
104
+ def generate(positive_prompt, negative_prompt, seed=42):
105
+ print("Generating...")
106
+ positive = CLIPTextEncode.encode(clip, positive_prompt)[0]
107
+ negative = CLIPTextEncode.encode(clip, negative_prompt)[0]
108
+ latent = EmptyLatentImage.generate(1024, 1024, batch_size=1)[0]
109
+
110
+ samples = KSampler.sample(
111
+ unet, seed=seed, steps=25, cfg=5.0,
112
+ sampler_name="euler", scheduler="normal",
113
+ positive=positive, negative=negative, latent_image=latent
114
+ )[0]
115
+
116
+ decoded = VAEDecode.decode(vae, samples)[0].detach()
117
+ img_array = np.array(decoded * 255, dtype=np.uint8)[0]
118
+
119
+ output_path = "output_anima.png"
120
+ Image.fromarray(img_array).save(output_path)
121
+ print(f"Done! Image saved as {output_path}")
122
+
123
+ prompt = "masterpiece, best quality, score_9, 1girl, solo, @wlop, cyberpunk city, neon lights"
124
+ negative_prompt = "blurry, ugly, low quality, score_1, score_2"
125
+
126
+ generate(prompt, negative_prompt, seed=42)
127
+ ```
128
+ ---
129
+
130
+ ## 👥 Credits & Attribution
131
+
132
+ * **Fine-Tuning & Custom Assembly:** Created by **[Kate-Katie07](https://huggingface.co/Kate-Katie07)**.
133
+ * **Base Architecture:** Developed by **NVIDIA (Cosmos)**.
134
+ * **Base Text-to-Image Model:** **Anima 2B** by **CircleStone Labs & ComfyOrg**.
135
+
136
+ 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!
137
+
138
+ ---