Instructions to use 8BitStudio/Aniimage-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use 8BitStudio/Aniimage-2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("8BitStudio/Aniimage-2", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Fix Diffusers downloads not counting.
Browse files- Aniimage_2_Interactive_Colab.ipynb +295 -296
- README.md +152 -152
- config.json +67 -0
- diffusion_pytorch_model.safetensors +3 -0
- generate_images.py +0 -0
- model_config.json +36 -0
Aniimage_2_Interactive_Colab.ipynb
CHANGED
|
@@ -1,296 +1,295 @@
|
|
| 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 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
"
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
"
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
"
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Aniimage-2 Image generator\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"This notebook runs [`8BitStudio/Aniimage-2`](https://huggingface.co/8BitStudio/Aniimage-2) with a Gradio interface. It manually assembles the repository's UNet with the matching VAE and CLIP text encoder because the repository is not packaged as a complete Diffusers pipeline.\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"## Before running\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"1. In Colab choose **Runtime → Change runtime type → T4 GPU** (or a better GPU).\n",
|
| 14 |
+
"2. Run every cell in order. The first model load downloads several gigabytes and can take a few minutes.\n",
|
| 15 |
+
"3. Open the Gradio link printed by the final cell. Generated images are also saved under `/content/aniimage2_outputs`.\n",
|
| 16 |
+
"\n",
|
| 17 |
+
"The defaults follow the model card: 512×512, DPM++ SDE Karras, 50 steps, v-prediction, zero-terminal-SNR, CLIP penultimate layer, and CFG rescale 0.7. The default negative prompt includes `NSFW` because omitting it may produce NSFW images.\n",
|
| 18 |
+
"\n",
|
| 19 |
+
"If you want to generate NSFW images, remove the `NSFW` text in the negative prompt. \n",
|
| 20 |
+
"\n",
|
| 21 |
+
"If your results look \"glitched\", try lowering your CFG to around 7 or 6.5"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": null,
|
| 27 |
+
"metadata": {},
|
| 28 |
+
"outputs": [],
|
| 29 |
+
"source": [
|
| 30 |
+
"!pip -q install -U \"diffusers>=0.37.1\" \"transformers>=4.46,<5\" accelerate safetensors huggingface_hub \"gradio>=5,<7\" \"click>=8.2\" \"Pillow<11.0.0\""
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"cell_type": "code",
|
| 35 |
+
"execution_count": null,
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"outputs": [],
|
| 38 |
+
"source": [
|
| 39 |
+
"import json\n",
|
| 40 |
+
"import random\n",
|
| 41 |
+
"from pathlib import Path\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"import gradio as gr\n",
|
| 44 |
+
"import numpy as np\n",
|
| 45 |
+
"import torch\n",
|
| 46 |
+
"from PIL import Image\n",
|
| 47 |
+
"from diffusers import (\n",
|
| 48 |
+
" AutoencoderKL,\n",
|
| 49 |
+
" DDIMScheduler,\n",
|
| 50 |
+
" DPMSolverMultistepScheduler,\n",
|
| 51 |
+
" EulerAncestralDiscreteScheduler,\n",
|
| 52 |
+
" EulerDiscreteScheduler,\n",
|
| 53 |
+
" UNet2DConditionModel,\n",
|
| 54 |
+
")\n",
|
| 55 |
+
"from huggingface_hub import hf_hub_download\n",
|
| 56 |
+
"from transformers import CLIPTextModel, CLIPTokenizer\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"REPO_ID = \"8BitStudio/Aniimage-2\"\n",
|
| 59 |
+
"CLIP_ID = \"openai/clip-vit-large-patch14\"\n",
|
| 60 |
+
"OUTPUT_DIR = Path(\"/content/aniimage2_outputs\")\n",
|
| 61 |
+
"OUTPUT_DIR.mkdir(parents=True, exist_ok=True)\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"if not torch.cuda.is_available():\n",
|
| 64 |
+
" raise RuntimeError(\"No GPU detected. In Colab select Runtime > Change runtime type > T4 GPU, then run again.\")\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"DEVICE = \"cuda\"\n",
|
| 67 |
+
"DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16\n",
|
| 68 |
+
"torch.backends.cuda.matmul.allow_tf32 = True\n",
|
| 69 |
+
"torch.backends.cudnn.allow_tf32 = True\n",
|
| 70 |
+
"print(f\"GPU: {torch.cuda.get_device_name(0)}\")\n",
|
| 71 |
+
"print(f\"Model dtype: {DTYPE}\")\n"
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"cell_type": "code",
|
| 76 |
+
"execution_count": null,
|
| 77 |
+
"metadata": {},
|
| 78 |
+
"outputs": [],
|
| 79 |
+
"source": [
|
| 80 |
+
"# Download the small model metadata first so every component matches training.\n",
|
| 81 |
+
"config_path = hf_hub_download(REPO_ID, \"model_config.json\")\n",
|
| 82 |
+
"with open(config_path, \"r\", encoding=\"utf-8\") as f:\n",
|
| 83 |
+
" MODEL_CONFIG = json.load(f)\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"VAE_ID = MODEL_CONFIG[\"vae\"]\n",
|
| 86 |
+
"GUIDANCE_RESCALE = float(MODEL_CONFIG.get(\"guidance_rescale\", 0.7))\n",
|
| 87 |
+
"\n",
|
| 88 |
+
"print(\"Loading Aniimage-2 UNet...\")\n",
|
| 89 |
+
"unet = UNet2DConditionModel.from_pretrained(\n",
|
| 90 |
+
" REPO_ID,\n",
|
| 91 |
+
" torch_dtype=DTYPE,\n",
|
| 92 |
+
" low_cpu_mem_usage=True,\n",
|
| 93 |
+
").to(DEVICE).eval()\n",
|
| 94 |
+
"unet.requires_grad_(False)\n",
|
| 95 |
+
"\n",
|
| 96 |
+
"print(f\"Loading VAE: {VAE_ID}...\")\n",
|
| 97 |
+
"vae = AutoencoderKL.from_pretrained(VAE_ID, torch_dtype=DTYPE).to(DEVICE).eval()\n",
|
| 98 |
+
"vae.requires_grad_(False)\n",
|
| 99 |
+
"vae.enable_slicing()\n",
|
| 100 |
+
"\n",
|
| 101 |
+
"print(f\"Loading text encoder: {CLIP_ID}...\")\n",
|
| 102 |
+
"tokenizer = CLIPTokenizer.from_pretrained(CLIP_ID)\n",
|
| 103 |
+
"text_encoder = CLIPTextModel.from_pretrained(CLIP_ID, torch_dtype=DTYPE).to(DEVICE).eval()\n",
|
| 104 |
+
"text_encoder.requires_grad_(False)\n",
|
| 105 |
+
"\n",
|
| 106 |
+
"# Aniimage-2 was trained using CLIP's penultimate transformer layer.\n",
|
| 107 |
+
"clip_inner = getattr(text_encoder, \"text_model\", text_encoder)\n",
|
| 108 |
+
"clip_inner.encoder.layers = torch.nn.ModuleList(list(clip_inner.encoder.layers[:-1]))\n",
|
| 109 |
+
"\n",
|
| 110 |
+
"print(\"Aniimage-2 is loaded and ready.\")\n"
|
| 111 |
+
]
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"cell_type": "code",
|
| 115 |
+
"execution_count": null,
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"outputs": [],
|
| 118 |
+
"source": [
|
| 119 |
+
"def make_scheduler(name):\n",
|
| 120 |
+
" base = dict(\n",
|
| 121 |
+
" num_train_timesteps=int(MODEL_CONFIG.get(\"num_train_timesteps\", 1000)),\n",
|
| 122 |
+
" beta_schedule=MODEL_CONFIG.get(\"beta_schedule\", \"scaled_linear\"),\n",
|
| 123 |
+
" prediction_type=MODEL_CONFIG.get(\"prediction_type\", \"v_prediction\"),\n",
|
| 124 |
+
" rescale_betas_zero_snr=bool(MODEL_CONFIG.get(\"zero_terminal_snr\", True)),\n",
|
| 125 |
+
" timestep_spacing=MODEL_CONFIG.get(\"timestep_spacing\", \"trailing\"),\n",
|
| 126 |
+
" )\n",
|
| 127 |
+
" if name == \"DPM++ SDE Karras\":\n",
|
| 128 |
+
" return DPMSolverMultistepScheduler(\n",
|
| 129 |
+
" **base, algorithm_type=\"sde-dpmsolver++\", solver_order=2, use_karras_sigmas=True\n",
|
| 130 |
+
" )\n",
|
| 131 |
+
" if name == \"DPM++ 2M Karras\":\n",
|
| 132 |
+
" return DPMSolverMultistepScheduler(\n",
|
| 133 |
+
" **base, algorithm_type=\"dpmsolver++\", solver_order=2, use_karras_sigmas=True\n",
|
| 134 |
+
" )\n",
|
| 135 |
+
" if name == \"Euler a\":\n",
|
| 136 |
+
" return EulerAncestralDiscreteScheduler(**base)\n",
|
| 137 |
+
" if name == \"Euler\":\n",
|
| 138 |
+
" return EulerDiscreteScheduler(**base)\n",
|
| 139 |
+
" if name == \"DDIM\":\n",
|
| 140 |
+
" return DDIMScheduler(**base, clip_sample=False, set_alpha_to_one=False)\n",
|
| 141 |
+
" raise ValueError(f\"Unknown scheduler: {name}\")\n",
|
| 142 |
+
"\n",
|
| 143 |
+
"\n",
|
| 144 |
+
"@torch.inference_mode()\n",
|
| 145 |
+
"def encode_prompts(prompt, negative_prompt):\n",
|
| 146 |
+
" tokens = tokenizer(\n",
|
| 147 |
+
" [negative_prompt or \"\", prompt],\n",
|
| 148 |
+
" padding=\"max_length\",\n",
|
| 149 |
+
" max_length=tokenizer.model_max_length,\n",
|
| 150 |
+
" truncation=True,\n",
|
| 151 |
+
" return_tensors=\"pt\",\n",
|
| 152 |
+
" )\n",
|
| 153 |
+
" return text_encoder(tokens.input_ids.to(DEVICE))[0]\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"\n",
|
| 156 |
+
"def rescale_cfg(noise_cfg, noise_text, amount):\n",
|
| 157 |
+
" dims = tuple(range(1, noise_cfg.ndim))\n",
|
| 158 |
+
" std_text = noise_text.std(dim=dims, keepdim=True)\n",
|
| 159 |
+
" std_cfg = noise_cfg.std(dim=dims, keepdim=True).clamp_min(1e-6)\n",
|
| 160 |
+
" noise_rescaled = noise_cfg * (std_text / std_cfg)\n",
|
| 161 |
+
" return amount * noise_rescaled + (1.0 - amount) * noise_cfg\n",
|
| 162 |
+
"\n",
|
| 163 |
+
"\n",
|
| 164 |
+
"@torch.inference_mode()\n",
|
| 165 |
+
"def generate_one(prompt, negative_prompt, scheduler_name, steps, cfg_scale, seed):\n",
|
| 166 |
+
" scheduler = make_scheduler(scheduler_name)\n",
|
| 167 |
+
" scheduler.set_timesteps(int(steps), device=DEVICE)\n",
|
| 168 |
+
" embeddings = encode_prompts(prompt, negative_prompt)\n",
|
| 169 |
+
"\n",
|
| 170 |
+
" generator = torch.Generator(device=DEVICE).manual_seed(int(seed))\n",
|
| 171 |
+
" latent_size = int(MODEL_CONFIG.get(\"image_size\", 512)) // 8\n",
|
| 172 |
+
" latents = torch.randn(\n",
|
| 173 |
+
" (1, int(unet.config.in_channels), latent_size, latent_size),\n",
|
| 174 |
+
" generator=generator, device=DEVICE, dtype=torch.float32,\n",
|
| 175 |
+
" ) * scheduler.init_noise_sigma\n",
|
| 176 |
+
"\n",
|
| 177 |
+
" for timestep in scheduler.timesteps:\n",
|
| 178 |
+
" latent_input = torch.cat([latents, latents], dim=0)\n",
|
| 179 |
+
" latent_input = scheduler.scale_model_input(latent_input, timestep)\n",
|
| 180 |
+
" with torch.autocast(\"cuda\", dtype=DTYPE):\n",
|
| 181 |
+
" prediction = unet(latent_input, timestep, encoder_hidden_states=embeddings).sample\n",
|
| 182 |
+
" pred_negative, pred_text = prediction.chunk(2)\n",
|
| 183 |
+
" prediction = pred_negative + float(cfg_scale) * (pred_text - pred_negative)\n",
|
| 184 |
+
" prediction = rescale_cfg(prediction, pred_text, GUIDANCE_RESCALE)\n",
|
| 185 |
+
" latents = scheduler.step(prediction, timestep, latents).prev_sample\n",
|
| 186 |
+
"\n",
|
| 187 |
+
" scaled = (latents / vae.config.scaling_factor).to(dtype=DTYPE)\n",
|
| 188 |
+
" with torch.autocast(\"cuda\", dtype=DTYPE):\n",
|
| 189 |
+
" image = vae.decode(scaled).sample\n",
|
| 190 |
+
" image = (image.float() / 2 + 0.5).clamp(0, 1)\n",
|
| 191 |
+
" array = (image[0].permute(1, 2, 0).cpu().numpy() * 255).round().astype(np.uint8)\n",
|
| 192 |
+
" return Image.fromarray(array)\n",
|
| 193 |
+
"\n",
|
| 194 |
+
"\n",
|
| 195 |
+
"def generate_gallery(prompt, negative_prompt, scheduler_name, steps, cfg_scale, seed, randomize_seed, image_count, progress=gr.Progress()):\n",
|
| 196 |
+
" prompt = (prompt or \"\").strip()\n",
|
| 197 |
+
" if not prompt:\n",
|
| 198 |
+
" raise gr.Error(\"Enter a prompt first.\")\n",
|
| 199 |
+
"\n",
|
| 200 |
+
" count = int(image_count)\n",
|
| 201 |
+
" base_seed = random.randint(0, 2**31 - 1) if randomize_seed or int(seed) < 0 else int(seed)\n",
|
| 202 |
+
" images, records = [], []\n",
|
| 203 |
+
"\n",
|
| 204 |
+
" for index in range(count):\n",
|
| 205 |
+
" used_seed = (base_seed + index) % (2**31)\n",
|
| 206 |
+
" progress(index / count, desc=f\"Generating image {index + 1} of {count}\")\n",
|
| 207 |
+
" image = generate_one(prompt, negative_prompt, scheduler_name, steps, cfg_scale, used_seed)\n",
|
| 208 |
+
" path = OUTPUT_DIR / f\"aniimage2_{used_seed}.png\"\n",
|
| 209 |
+
" image.save(path)\n",
|
| 210 |
+
" images.append(image)\n",
|
| 211 |
+
" records.append(f\"- Seed `{used_seed}` — `{path}`\")\n",
|
| 212 |
+
"\n",
|
| 213 |
+
" progress(1.0, desc=\"Done\")\n",
|
| 214 |
+
" details = \"### Results\\n\" + \"\\n\".join(records)\n",
|
| 215 |
+
" return images, details, base_seed\n"
|
| 216 |
+
]
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"cell_type": "code",
|
| 220 |
+
"execution_count": null,
|
| 221 |
+
"metadata": {},
|
| 222 |
+
"outputs": [],
|
| 223 |
+
"source": [
|
| 224 |
+
"DEFAULT_NEGATIVE = (\n",
|
| 225 |
+
" \"NSFW, low quality, ugly, blurry, distorted, deformed, bad anatomy, bad proportions, \"\n",
|
| 226 |
+
" \"extra limbs, missing limbs, watermark, text, signature, washed out, flat colors, \"\n",
|
| 227 |
+
" \"manga panel, disfigured, poorly drawn, jpeg artifacts, cropped, out of frame\"\n",
|
| 228 |
+
")\n",
|
| 229 |
+
"\n",
|
| 230 |
+
"with gr.Blocks(title=\"Aniimage-2 Generator\", theme=gr.themes.Soft()) as demo:\n",
|
| 231 |
+
" gr.Markdown(\n",
|
| 232 |
+
" \"# Aniimage-2 Interactive Generator\\n\"\n",
|
| 233 |
+
" \"Use a short plain-English prompt for best results. Images are 512×512.\"\n",
|
| 234 |
+
" )\n",
|
| 235 |
+
" with gr.Row():\n",
|
| 236 |
+
" with gr.Column(scale=2):\n",
|
| 237 |
+
" prompt = gr.Textbox(\n",
|
| 238 |
+
" label=\"Prompt\",\n",
|
| 239 |
+
" value=\"A smiling anime girl with red hair and a school uniform\",\n",
|
| 240 |
+
" lines=3,\n",
|
| 241 |
+
" )\n",
|
| 242 |
+
" negative = gr.Textbox(label=\"Negative prompt\", value=DEFAULT_NEGATIVE, lines=4)\n",
|
| 243 |
+
" generate_button = gr.Button(\"Generate\", variant=\"primary\")\n",
|
| 244 |
+
" with gr.Column(scale=1):\n",
|
| 245 |
+
" scheduler = gr.Dropdown(\n",
|
| 246 |
+
" [\"DPM++ SDE Karras\", \"DPM++ 2M Karras\", \"Euler a\", \"Euler\", \"DDIM\"],\n",
|
| 247 |
+
" value=\"DPM++ SDE Karras\", label=\"Scheduler\",\n",
|
| 248 |
+
" )\n",
|
| 249 |
+
" steps = gr.Slider(10, 80, value=50, step=1, label=\"Steps\")\n",
|
| 250 |
+
" cfg = gr.Slider(1.0, 15.0, value=7.5, step=0.1, label=\"CFG scale\")\n",
|
| 251 |
+
" seed = gr.Number(value=-1, precision=0, label=\"Seed (-1 = random)\")\n",
|
| 252 |
+
" randomize = gr.Checkbox(value=True, label=\"Randomize seed\")\n",
|
| 253 |
+
" count = gr.Slider(1, 4, value=1, step=1, label=\"Number of images\")\n",
|
| 254 |
+
"\n",
|
| 255 |
+
" gallery = gr.Gallery(label=\"Generated images\", columns=2, object_fit=\"contain\", height=620)\n",
|
| 256 |
+
" result_info = gr.Markdown()\n",
|
| 257 |
+
"\n",
|
| 258 |
+
" generate_button.click(\n",
|
| 259 |
+
" fn=generate_gallery,\n",
|
| 260 |
+
" inputs=[prompt, negative, scheduler, steps, cfg, seed, randomize, count],\n",
|
| 261 |
+
" outputs=[gallery, result_info, seed],\n",
|
| 262 |
+
" concurrency_limit=1,\n",
|
| 263 |
+
" )\n",
|
| 264 |
+
"\n",
|
| 265 |
+
"demo.queue(max_size=8)\n",
|
| 266 |
+
"print(\"Interface created. Run the final cell to launch it.\")\n"
|
| 267 |
+
]
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"cell_type": "code",
|
| 271 |
+
"execution_count": null,
|
| 272 |
+
"metadata": {},
|
| 273 |
+
"outputs": [],
|
| 274 |
+
"source": [
|
| 275 |
+
"demo.launch(share=True, show_error=True)\n"
|
| 276 |
+
]
|
| 277 |
+
}
|
| 278 |
+
],
|
| 279 |
+
"metadata": {
|
| 280 |
+
"accelerator": "GPU",
|
| 281 |
+
"colab": {
|
| 282 |
+
"name": "Aniimage_2_Interactive_Colab.ipynb",
|
| 283 |
+
"provenance": []
|
| 284 |
+
},
|
| 285 |
+
"kernelspec": {
|
| 286 |
+
"display_name": "Python 3",
|
| 287 |
+
"name": "python3"
|
| 288 |
+
},
|
| 289 |
+
"language_info": {
|
| 290 |
+
"name": "python"
|
| 291 |
+
}
|
| 292 |
+
},
|
| 293 |
+
"nbformat": 4,
|
| 294 |
+
"nbformat_minor": 5
|
| 295 |
+
}
|
|
|
README.md
CHANGED
|
@@ -1,153 +1,153 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
tags:
|
| 4 |
-
- anime
|
| 5 |
-
- diffusion
|
| 6 |
-
- text-to-image
|
| 7 |
-
- image-generation
|
| 8 |
-
library_name: diffusers
|
| 9 |
-
pipeline_tag: text-to-image
|
| 10 |
-
language:
|
| 11 |
-
- en
|
| 12 |
-
---
|
| 13 |
-

|
| 14 |
-
|
| 15 |
-
# Aniimage-2
|
| 16 |
-
|
| 17 |
-
Aniimage-2 is the second public model in the Aniimage series.
|
| 18 |
-
The model is a 512x512 anime image generation model trained from scratch using a UNet + VAE + CLIP architecture with 441.9 million parameters.
|
| 19 |
-
Aniimage-2 has been trained on 1.2M anime images from [Danbooru](https://danbooru.donmai.us/) and other sources.
|
| 20 |
-
It is not based on any existing models, the UNet is trained from scratch.
|
| 21 |
-
|
| 22 |
-
## Model Details
|
| 23 |
-
|
| 24 |
-
| | |
|
| 25 |
-
|---|---|
|
| 26 |
-
| **Resolution** | 512x512 |
|
| 27 |
-
| **Architecture** | Latent Diffusion (UNet + VAE + CLIP) |
|
| 28 |
-
| **Parameters** | 441.9M |
|
| 29 |
-
| **Training Steps** | 70,000 |
|
| 30 |
-
| **Batch Size** | 64 |
|
| 31 |
-
| **Dataset** | ~1.2 million curated anime images from Danbooru |
|
| 32 |
-
| **GPU** | NVIDIA RTX 5060 Ti 16GB |
|
| 33 |
-
| **Scheduler** | DPM++ SDE |
|
| 34 |
-
| **Step count** | 50 using DPM++ SDE|
|
| 35 |
-
|
| 36 |
-
## Requirements
|
| 37 |
-
|
| 38 |
-
- **GPU**: ~6 GB VRAM minimum (recommend 8+ GB)
|
| 39 |
-
- **CPU**: ~7 GB RAM. Image generation is extremely slow on CPU. (recommend 10+ GB)
|
| 40 |
-
|
| 41 |
-
## Prompting
|
| 42 |
-
|
| 43 |
-
Aniimage uses plain text captions as well as Danbooru tags.
|
| 44 |
-
|
| 45 |
-
An example of acceptable captions:
|
| 46 |
-
|
| 47 |
-
"A smiling anime girl with red hair and a school uniform"
|
| 48 |
-
|
| 49 |
-
"1girl, solo, smile, red_hair, school_uniform, anime_coloring"
|
| 50 |
-
|
| 51 |
-
Long prompts and enhanced prompts usually result in worse overall results. Try to keep your prompts short.
|
| 52 |
-
|
| 53 |
-
Although you can use Danbooru tags, you will get the best results with plain text captions
|
| 54 |
-
|
| 55 |
-
Adding a negative prompt is required for a good output. The one used during inference in the preview image is:
|
| 56 |
-
|
| 57 |
-
"low quality, ugly, blurry, distorted, deformed, bad anatomy, bad proportions, extra limbs, missing limbs, watermark, text, signature, washed out, flat colors, manga panel, disfigured, poorly drawn, jpeg artifacts, cropped, out of frame"
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
For the best quality, use DPM++ SDE at 50 steps.
|
| 61 |
-
|
| 62 |
-
**Important:** If you do not include “NSFW” in the negative prompt, the model may generate NSFW images
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
## Run
|
| 66 |
-
|
| 67 |
-
[](https://colab.research.google.com/#fileId=https://huggingface.co/8BitStudio/Aniimage-2/blob/main/Aniimage_2_Interactive_Colab.ipynb)
|
| 68 |
-
|
| 69 |
-
[](https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/generate_images.py)
|
| 70 |
-
|
| 71 |
-
after downloading, install the dependencies.
|
| 72 |
-
|
| 73 |
-
```bash
|
| 74 |
-
pip install torch torchvision diffusers transformers safetensors pillow huggingface_hub
|
| 75 |
-
python
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
## Capabilities
|
| 79 |
-
|
| 80 |
-
Aniimage-2 has significantly higher capabilities than [Aniimage-1](https://huggingface.co/8BitStudio/Aniimage-1). Especially when it comes to backgrounds.
|
| 81 |
-
|
| 82 |
-
<table width="700">
|
| 83 |
-
<tr>
|
| 84 |
-
<td colspan="2">
|
| 85 |
-
<img
|
| 86 |
-
src="https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/assets/Softly%20lit%20forest%20at%20midday%2C%20peaceful%20atmosphere%2C%20no%20people.png"
|
| 87 |
-
width="700"
|
| 88 |
-
alt="Forest comparison between Aniimage-1 and Aniimage-2"
|
| 89 |
-
>
|
| 90 |
-
</td>
|
| 91 |
-
</tr>
|
| 92 |
-
|
| 93 |
-
<tr>
|
| 94 |
-
<td align="center" width="50%">
|
| 95 |
-
<b>Aniimage-1</b>
|
| 96 |
-
</td>
|
| 97 |
-
<td align="center" width="50%">
|
| 98 |
-
<b>Aniimage-2</b>
|
| 99 |
-
</td>
|
| 100 |
-
</tr>
|
| 101 |
-
|
| 102 |
-
<tr>
|
| 103 |
-
<td colspan="2">
|
| 104 |
-
<sub>Prompt: Softly lit forest at midday, peaceful atmosphere, no people.</sub>
|
| 105 |
-
</td>
|
| 106 |
-
</tr>
|
| 107 |
-
</table>
|
| 108 |
-
|
| 109 |
-
<table width="700">
|
| 110 |
-
<tr>
|
| 111 |
-
<td colspan="2">
|
| 112 |
-
<img
|
| 113 |
-
src="https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/assets/anime-boy.png"
|
| 114 |
-
width="700"
|
| 115 |
-
alt="Anime boy comparison between Aniimage-1 and Aniimage-2"
|
| 116 |
-
>
|
| 117 |
-
</td>
|
| 118 |
-
</tr>
|
| 119 |
-
|
| 120 |
-
<tr>
|
| 121 |
-
<td align="center" width="50%">
|
| 122 |
-
<b>Aniimage-1</b>
|
| 123 |
-
</td>
|
| 124 |
-
<td align="center" width="50%">
|
| 125 |
-
<b>Aniimage-2</b>
|
| 126 |
-
</td>
|
| 127 |
-
</tr>
|
| 128 |
-
|
| 129 |
-
Aniimage-2 produces male characters much more reliably than Aniimage-1.
|
| 130 |
-
|
| 131 |
-
<tr>
|
| 132 |
-
<td colspan="2">
|
| 133 |
-
<sub>Prompt: An anime boy with black hair and green eyes.</sub>
|
| 134 |
-
</td>
|
| 135 |
-
</tr>
|
| 136 |
-
</table>
|
| 137 |
-
|
| 138 |
-
## Limitations
|
| 139 |
-
|
| 140 |
-
Aniimage-2 is bad at generating hands. It may generate hands but they often melt into surfaces if they are similar colors and usually have more or fewer than five fingers.
|
| 141 |
-
The model generates male characters less reliably than female characters, it may take many images to find a good image like above.
|
| 142 |
-
|
| 143 |
-
## What's Next
|
| 144 |
-
|
| 145 |
-
Aniimage-3 is currently in the works and will have a much higher parameter count: 738.1M parameters compared to aniimage-2 and aniimage-1's 441.9M parameters.
|
| 146 |
-
The model will also have significantly more unique images.
|
| 147 |
-
Aniimage-2 used incorrect Min-SNR loss weighting with its v-prediction objective, causing near-pure-noise timesteps to receive excessive emphasis. This has been corrected for Aniimage-3.
|
| 148 |
-
Aniimage-3 also uses a much higher-quality dataset with improved filtering. More than 100,000 low-quality images from the Aniimage-2 dataset were removed.
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
## License
|
| 152 |
-
|
| 153 |
Apache 2.0
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- anime
|
| 5 |
+
- diffusion
|
| 6 |
+
- text-to-image
|
| 7 |
+
- image-generation
|
| 8 |
+
library_name: diffusers
|
| 9 |
+
pipeline_tag: text-to-image
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
---
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
# Aniimage-2
|
| 16 |
+
|
| 17 |
+
Aniimage-2 is the second public model in the Aniimage series.
|
| 18 |
+
The model is a 512x512 anime image generation model trained from scratch using a UNet + VAE + CLIP architecture with 441.9 million parameters.
|
| 19 |
+
Aniimage-2 has been trained on 1.2M anime images from [Danbooru](https://danbooru.donmai.us/) and other sources.
|
| 20 |
+
It is not based on any existing models, the UNet is trained from scratch.
|
| 21 |
+
|
| 22 |
+
## Model Details
|
| 23 |
+
|
| 24 |
+
| | |
|
| 25 |
+
|---|---|
|
| 26 |
+
| **Resolution** | 512x512 |
|
| 27 |
+
| **Architecture** | Latent Diffusion (UNet + VAE + CLIP) |
|
| 28 |
+
| **Parameters** | 441.9M |
|
| 29 |
+
| **Training Steps** | 70,000 |
|
| 30 |
+
| **Batch Size** | 64 |
|
| 31 |
+
| **Dataset** | ~1.2 million curated anime images from Danbooru |
|
| 32 |
+
| **GPU** | NVIDIA RTX 5060 Ti 16GB |
|
| 33 |
+
| **Scheduler** | DPM++ SDE |
|
| 34 |
+
| **Step count** | 50 using DPM++ SDE|
|
| 35 |
+
|
| 36 |
+
## Requirements
|
| 37 |
+
|
| 38 |
+
- **GPU**: ~6 GB VRAM minimum (recommend 8+ GB)
|
| 39 |
+
- **CPU**: ~7 GB RAM. Image generation is extremely slow on CPU. (recommend 10+ GB)
|
| 40 |
+
|
| 41 |
+
## Prompting
|
| 42 |
+
|
| 43 |
+
Aniimage uses plain text captions as well as Danbooru tags.
|
| 44 |
+
|
| 45 |
+
An example of acceptable captions:
|
| 46 |
+
|
| 47 |
+
"A smiling anime girl with red hair and a school uniform"
|
| 48 |
+
|
| 49 |
+
"1girl, solo, smile, red_hair, school_uniform, anime_coloring"
|
| 50 |
+
|
| 51 |
+
Long prompts and enhanced prompts usually result in worse overall results. Try to keep your prompts short.
|
| 52 |
+
|
| 53 |
+
Although you can use Danbooru tags, you will get the best results with plain text captions
|
| 54 |
+
|
| 55 |
+
Adding a negative prompt is required for a good output. The one used during inference in the preview image is:
|
| 56 |
+
|
| 57 |
+
"low quality, ugly, blurry, distorted, deformed, bad anatomy, bad proportions, extra limbs, missing limbs, watermark, text, signature, washed out, flat colors, manga panel, disfigured, poorly drawn, jpeg artifacts, cropped, out of frame"
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
For the best quality, use DPM++ SDE at 50 steps.
|
| 61 |
+
|
| 62 |
+
**Important:** If you do not include “NSFW” in the negative prompt, the model may generate NSFW images
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
## Run
|
| 66 |
+
|
| 67 |
+
[](https://colab.research.google.com/#fileId=https://huggingface.co/8BitStudio/Aniimage-2/blob/main/Aniimage_2_Interactive_Colab.ipynb)
|
| 68 |
+
|
| 69 |
+
[](https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/generate_images.py)
|
| 70 |
+
|
| 71 |
+
after downloading, install the dependencies.
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
pip install torch torchvision diffusers transformers safetensors pillow huggingface_hub
|
| 75 |
+
python generate_images.py
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Capabilities
|
| 79 |
+
|
| 80 |
+
Aniimage-2 has significantly higher capabilities than [Aniimage-1](https://huggingface.co/8BitStudio/Aniimage-1). Especially when it comes to backgrounds.
|
| 81 |
+
|
| 82 |
+
<table width="700">
|
| 83 |
+
<tr>
|
| 84 |
+
<td colspan="2">
|
| 85 |
+
<img
|
| 86 |
+
src="https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/assets/Softly%20lit%20forest%20at%20midday%2C%20peaceful%20atmosphere%2C%20no%20people.png"
|
| 87 |
+
width="700"
|
| 88 |
+
alt="Forest comparison between Aniimage-1 and Aniimage-2"
|
| 89 |
+
>
|
| 90 |
+
</td>
|
| 91 |
+
</tr>
|
| 92 |
+
|
| 93 |
+
<tr>
|
| 94 |
+
<td align="center" width="50%">
|
| 95 |
+
<b>Aniimage-1</b>
|
| 96 |
+
</td>
|
| 97 |
+
<td align="center" width="50%">
|
| 98 |
+
<b>Aniimage-2</b>
|
| 99 |
+
</td>
|
| 100 |
+
</tr>
|
| 101 |
+
|
| 102 |
+
<tr>
|
| 103 |
+
<td colspan="2">
|
| 104 |
+
<sub>Prompt: Softly lit forest at midday, peaceful atmosphere, no people.</sub>
|
| 105 |
+
</td>
|
| 106 |
+
</tr>
|
| 107 |
+
</table>
|
| 108 |
+
|
| 109 |
+
<table width="700">
|
| 110 |
+
<tr>
|
| 111 |
+
<td colspan="2">
|
| 112 |
+
<img
|
| 113 |
+
src="https://huggingface.co/8BitStudio/Aniimage-2/resolve/main/assets/anime-boy.png"
|
| 114 |
+
width="700"
|
| 115 |
+
alt="Anime boy comparison between Aniimage-1 and Aniimage-2"
|
| 116 |
+
>
|
| 117 |
+
</td>
|
| 118 |
+
</tr>
|
| 119 |
+
|
| 120 |
+
<tr>
|
| 121 |
+
<td align="center" width="50%">
|
| 122 |
+
<b>Aniimage-1</b>
|
| 123 |
+
</td>
|
| 124 |
+
<td align="center" width="50%">
|
| 125 |
+
<b>Aniimage-2</b>
|
| 126 |
+
</td>
|
| 127 |
+
</tr>
|
| 128 |
+
|
| 129 |
+
Aniimage-2 produces male characters much more reliably than Aniimage-1.
|
| 130 |
+
|
| 131 |
+
<tr>
|
| 132 |
+
<td colspan="2">
|
| 133 |
+
<sub>Prompt: An anime boy with black hair and green eyes.</sub>
|
| 134 |
+
</td>
|
| 135 |
+
</tr>
|
| 136 |
+
</table>
|
| 137 |
+
|
| 138 |
+
## Limitations
|
| 139 |
+
|
| 140 |
+
Aniimage-2 is bad at generating hands. It may generate hands but they often melt into surfaces if they are similar colors and usually have more or fewer than five fingers.
|
| 141 |
+
The model generates male characters less reliably than female characters, it may take many images to find a good image like above.
|
| 142 |
+
|
| 143 |
+
## What's Next
|
| 144 |
+
|
| 145 |
+
Aniimage-3 is currently in the works and will have a much higher parameter count: 738.1M parameters compared to aniimage-2 and aniimage-1's 441.9M parameters.
|
| 146 |
+
The model will also have significantly more unique images.
|
| 147 |
+
Aniimage-2 used incorrect Min-SNR loss weighting with its v-prediction objective, causing near-pure-noise timesteps to receive excessive emphasis. This has been corrected for Aniimage-3.
|
| 148 |
+
Aniimage-3 also uses a much higher-quality dataset with improved filtering. More than 100,000 low-quality images from the Aniimage-2 dataset were removed.
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
## License
|
| 152 |
+
|
| 153 |
Apache 2.0
|
config.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "UNet2DConditionModel",
|
| 3 |
+
"_diffusers_version": "0.37.1",
|
| 4 |
+
"act_fn": "silu",
|
| 5 |
+
"addition_embed_type": null,
|
| 6 |
+
"addition_embed_type_num_heads": 64,
|
| 7 |
+
"addition_time_embed_dim": null,
|
| 8 |
+
"attention_head_dim": 8,
|
| 9 |
+
"attention_type": "default",
|
| 10 |
+
"block_out_channels": [
|
| 11 |
+
256,
|
| 12 |
+
512,
|
| 13 |
+
768,
|
| 14 |
+
1024
|
| 15 |
+
],
|
| 16 |
+
"center_input_sample": false,
|
| 17 |
+
"class_embed_type": null,
|
| 18 |
+
"class_embeddings_concat": false,
|
| 19 |
+
"conv_in_kernel": 3,
|
| 20 |
+
"conv_out_kernel": 3,
|
| 21 |
+
"cross_attention_dim": 768,
|
| 22 |
+
"cross_attention_norm": null,
|
| 23 |
+
"down_block_types": [
|
| 24 |
+
"CrossAttnDownBlock2D",
|
| 25 |
+
"CrossAttnDownBlock2D",
|
| 26 |
+
"CrossAttnDownBlock2D",
|
| 27 |
+
"DownBlock2D"
|
| 28 |
+
],
|
| 29 |
+
"downsample_padding": 1,
|
| 30 |
+
"dropout": 0.0,
|
| 31 |
+
"dual_cross_attention": false,
|
| 32 |
+
"encoder_hid_dim": null,
|
| 33 |
+
"encoder_hid_dim_type": null,
|
| 34 |
+
"flip_sin_to_cos": true,
|
| 35 |
+
"freq_shift": 0,
|
| 36 |
+
"in_channels": 4,
|
| 37 |
+
"layers_per_block": 2,
|
| 38 |
+
"mid_block_only_cross_attention": null,
|
| 39 |
+
"mid_block_scale_factor": 1,
|
| 40 |
+
"mid_block_type": "UNetMidBlock2DCrossAttn",
|
| 41 |
+
"norm_eps": 1e-05,
|
| 42 |
+
"norm_num_groups": 32,
|
| 43 |
+
"num_attention_heads": null,
|
| 44 |
+
"num_class_embeds": null,
|
| 45 |
+
"only_cross_attention": false,
|
| 46 |
+
"out_channels": 4,
|
| 47 |
+
"projection_class_embeddings_input_dim": null,
|
| 48 |
+
"resnet_out_scale_factor": 1.0,
|
| 49 |
+
"resnet_skip_time_act": false,
|
| 50 |
+
"resnet_time_scale_shift": "default",
|
| 51 |
+
"reverse_transformer_layers_per_block": null,
|
| 52 |
+
"sample_size": 64,
|
| 53 |
+
"time_cond_proj_dim": null,
|
| 54 |
+
"time_embedding_act_fn": null,
|
| 55 |
+
"time_embedding_dim": null,
|
| 56 |
+
"time_embedding_type": "positional",
|
| 57 |
+
"timestep_post_act": null,
|
| 58 |
+
"transformer_layers_per_block": 1,
|
| 59 |
+
"up_block_types": [
|
| 60 |
+
"UpBlock2D",
|
| 61 |
+
"CrossAttnUpBlock2D",
|
| 62 |
+
"CrossAttnUpBlock2D",
|
| 63 |
+
"CrossAttnUpBlock2D"
|
| 64 |
+
],
|
| 65 |
+
"upcast_attention": false,
|
| 66 |
+
"use_linear_projection": false
|
| 67 |
+
}
|
diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c298c8d61a380e4941d02372bf2e7de27de15ecd28c2236cd005c59c598105a4
|
| 3 |
+
size 1767752200
|
generate_images.py
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"unet": {
|
| 3 |
+
"sample_size": 64,
|
| 4 |
+
"in_channels": 4,
|
| 5 |
+
"out_channels": 4,
|
| 6 |
+
"layers_per_block": 2,
|
| 7 |
+
"block_out_channels": [
|
| 8 |
+
256,
|
| 9 |
+
512,
|
| 10 |
+
768,
|
| 11 |
+
1024
|
| 12 |
+
],
|
| 13 |
+
"down_block_types": [
|
| 14 |
+
"CrossAttnDownBlock2D",
|
| 15 |
+
"CrossAttnDownBlock2D",
|
| 16 |
+
"CrossAttnDownBlock2D",
|
| 17 |
+
"DownBlock2D"
|
| 18 |
+
],
|
| 19 |
+
"up_block_types": [
|
| 20 |
+
"UpBlock2D",
|
| 21 |
+
"CrossAttnUpBlock2D",
|
| 22 |
+
"CrossAttnUpBlock2D",
|
| 23 |
+
"CrossAttnUpBlock2D"
|
| 24 |
+
],
|
| 25 |
+
"cross_attention_dim": 768,
|
| 26 |
+
"attention_head_dim": 8
|
| 27 |
+
},
|
| 28 |
+
"prediction_type": "v_prediction",
|
| 29 |
+
"zero_terminal_snr": true,
|
| 30 |
+
"beta_schedule": "scaled_linear",
|
| 31 |
+
"num_train_timesteps": 1000,
|
| 32 |
+
"clip_penultimate": true,
|
| 33 |
+
"guidance_rescale": 0.7,
|
| 34 |
+
"image_size": 512,
|
| 35 |
+
"vae": "madebyollin/sdxl-vae-fp16-fix"
|
| 36 |
+
}
|