Spaces:
Build error
Build error
FridaKahlosArtCenter
commited on
Commit
·
2740cfb
1
Parent(s):
2250517
added assets, models, initial script
Browse files- app.py +83 -4
- assets/city_image.jpg +0 -0
- assets/logo.jpg +0 -0
- assets/nature_mug_image.jpg +0 -0
- models/kandinsky-2-2-decoder/model_index.json +41 -0
- models/kandinsky-2-2-decoder/movq/config.json +34 -0
- models/kandinsky-2-2-decoder/movq/diffusion_pytorch_model.safetensors +3 -0
- models/kandinsky-2-2-decoder/prior_image_encoder/config.json +23 -0
- models/kandinsky-2-2-decoder/prior_image_encoder/model.safetensors +3 -0
- models/kandinsky-2-2-decoder/prior_image_processor/preprocessor_config.json +29 -0
- models/kandinsky-2-2-decoder/prior_prior/config.json +20 -0
- models/kandinsky-2-2-decoder/prior_prior/diffusion_pytorch_model.safetensors +3 -0
- models/kandinsky-2-2-decoder/prior_scheduler/scheduler_config.json +10 -0
- models/kandinsky-2-2-decoder/prior_text_encoder/config.json +25 -0
- models/kandinsky-2-2-decoder/prior_text_encoder/model.safetensors +3 -0
- models/kandinsky-2-2-decoder/prior_tokenizer/merges.txt +0 -0
- models/kandinsky-2-2-decoder/prior_tokenizer/special_tokens_map.json +24 -0
- models/kandinsky-2-2-decoder/prior_tokenizer/tokenizer_config.json +30 -0
- models/kandinsky-2-2-decoder/prior_tokenizer/vocab.json +0 -0
- models/kandinsky-2-2-decoder/scheduler/scheduler_config.json +19 -0
- models/kandinsky-2-2-decoder/unet/config.json +68 -0
- models/kandinsky-2-2-decoder/unet/diffusion_pytorch_model.safetensors +3 -0
- requirements.txt +8 -0
app.py
CHANGED
@@ -1,7 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import AutoPipelineForImage2Image
|
3 |
+
from PIL import Image, ImageDraw, ImageFont
|
4 |
+
import requests
|
5 |
+
from io import BytesIO
|
6 |
import gradio as gr
|
7 |
|
8 |
+
# log gpu availabilitu
|
9 |
+
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
10 |
+
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
11 |
|
12 |
+
|
13 |
+
def image_to_template(generated_image, logo, button_text, punchline, theme_color):
|
14 |
+
# Resize logo if needed
|
15 |
+
logo = logo.resize((100, 100)) # Example size, adjust as needed
|
16 |
+
|
17 |
+
# Create a blank canvas with extra space for logo, punchline, and button
|
18 |
+
canvas_width = max(generated_image.width, logo.width) * 2
|
19 |
+
canvas_height = generated_image.height + logo.height + 100
|
20 |
+
canvas = Image.new('RGB', (canvas_width, canvas_height), 'white')
|
21 |
+
|
22 |
+
# Paste the logo and the generated image onto the canvas
|
23 |
+
canvas.paste(logo, (10, 10)) # Adjust position as needed
|
24 |
+
canvas.paste(generated_image, (0, logo.height + 20))
|
25 |
+
|
26 |
+
# Add punchline and button
|
27 |
+
draw = ImageDraw.Draw(canvas)
|
28 |
+
font = ImageFont.load_default() # Or use a custom font
|
29 |
+
text_color = theme_color
|
30 |
+
|
31 |
+
# Draw punchline
|
32 |
+
draw.text((10, logo.height + generated_image.height + 30), punchline, fill=text_color, font=font)
|
33 |
+
|
34 |
+
# Draw button
|
35 |
+
button_position = (10, logo.height + generated_image.height + 60) # Adjust as needed
|
36 |
+
draw.rectangle([button_position, (canvas_width - 10, canvas_height - 10)], outline=theme_color, fill=text_color)
|
37 |
+
draw.text(button_position, button_text, font=font)
|
38 |
+
|
39 |
+
return canvas
|
40 |
+
|
41 |
+
def generate_template(initial_image, logo, prompt, button_text, punchline, image_color, theme_color):
|
42 |
+
pipeline = AutoPipelineForImage2Image.from_pretrained(
|
43 |
+
"./models/kandinsky-2-2-decoder",
|
44 |
+
torch_dtype=torch.float16,
|
45 |
+
variant="fp16",
|
46 |
+
use_safetensors=True
|
47 |
+
)
|
48 |
+
|
49 |
+
# pipeline.unet = torch.compile(pipeline.unet, mode="reduce-overhead", fullgraph=True)
|
50 |
+
pipeline.enable_model_cpu_offload()
|
51 |
+
|
52 |
+
prompt = f"{prompt}, include the color {image_color}"
|
53 |
+
negative_prompt = "low quality, bad quality, blurry, unprofessional"
|
54 |
+
|
55 |
+
generated_image = pipeline(
|
56 |
+
prompt=prompt,
|
57 |
+
negative_prompt=negative_prompt,
|
58 |
+
image=initial_image,
|
59 |
+
height=256,
|
60 |
+
width=256).images[0]
|
61 |
+
|
62 |
+
template_image = image_to_template(generated_image, logo, button_text, punchline, theme_color)
|
63 |
+
|
64 |
+
return template_image
|
65 |
+
|
66 |
+
# Set up Gradio interface
|
67 |
+
iface = gr.Interface(
|
68 |
+
fn=generate_template,
|
69 |
+
inputs=[gr.inputs.Image(type="pil", label="Initial Image"),
|
70 |
+
gr.inputs.Image(type="pil", label="Logo"),
|
71 |
+
gr.inputs.Textbox(label="Prompt"),
|
72 |
+
gr.inputs.Textbox(label="Button Text"),
|
73 |
+
gr.inputs.Textbox(label="Punchline"),
|
74 |
+
gr.inputs.ColorPicker(label="Image Color"),
|
75 |
+
gr.inputs.ColorPicker(label="Theme Color")],
|
76 |
+
outputs=[gr.outputs.Image(type="pil")],
|
77 |
+
title="Ad Template Generation Using Diffusion Models Demo",
|
78 |
+
description="Generate ad template based on your inputs using a trained model.",
|
79 |
+
concurrency_limit=2,
|
80 |
+
# examples=[
|
81 |
+
# []
|
82 |
+
# ]
|
83 |
+
)
|
84 |
+
|
85 |
+
# Run the interface
|
86 |
+
iface.launch()
|
assets/city_image.jpg
ADDED
![]() |
assets/logo.jpg
ADDED
![]() |
assets/nature_mug_image.jpg
ADDED
![]() |
models/kandinsky-2-2-decoder/model_index.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "KandinskyV22Img2ImgCombinedPipeline",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"_name_or_path": "kandinsky-community/kandinsky-2-2-decoder",
|
5 |
+
"movq": [
|
6 |
+
"diffusers",
|
7 |
+
"VQModel"
|
8 |
+
],
|
9 |
+
"prior_image_encoder": [
|
10 |
+
"transformers",
|
11 |
+
"CLIPVisionModelWithProjection"
|
12 |
+
],
|
13 |
+
"prior_image_processor": [
|
14 |
+
"transformers",
|
15 |
+
"CLIPImageProcessor"
|
16 |
+
],
|
17 |
+
"prior_prior": [
|
18 |
+
"diffusers",
|
19 |
+
"PriorTransformer"
|
20 |
+
],
|
21 |
+
"prior_scheduler": [
|
22 |
+
"diffusers",
|
23 |
+
"UnCLIPScheduler"
|
24 |
+
],
|
25 |
+
"prior_text_encoder": [
|
26 |
+
"transformers",
|
27 |
+
"CLIPTextModelWithProjection"
|
28 |
+
],
|
29 |
+
"prior_tokenizer": [
|
30 |
+
"transformers",
|
31 |
+
"CLIPTokenizer"
|
32 |
+
],
|
33 |
+
"scheduler": [
|
34 |
+
"diffusers",
|
35 |
+
"DDPMScheduler"
|
36 |
+
],
|
37 |
+
"unet": [
|
38 |
+
"diffusers",
|
39 |
+
"UNet2DConditionModel"
|
40 |
+
]
|
41 |
+
}
|
models/kandinsky-2-2-decoder/movq/config.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "VQModel",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"_name_or_path": "C:\\Users\\edesa\\.cache\\huggingface\\hub\\models--kandinsky-community--kandinsky-2-2-decoder\\snapshots\\9ae140d347fed8ce6e8bb3005dcc1f48543bb8e3\\movq",
|
5 |
+
"act_fn": "silu",
|
6 |
+
"block_out_channels": [
|
7 |
+
128,
|
8 |
+
256,
|
9 |
+
256,
|
10 |
+
512
|
11 |
+
],
|
12 |
+
"down_block_types": [
|
13 |
+
"DownEncoderBlock2D",
|
14 |
+
"DownEncoderBlock2D",
|
15 |
+
"DownEncoderBlock2D",
|
16 |
+
"AttnDownEncoderBlock2D"
|
17 |
+
],
|
18 |
+
"in_channels": 3,
|
19 |
+
"latent_channels": 4,
|
20 |
+
"layers_per_block": 2,
|
21 |
+
"norm_num_groups": 32,
|
22 |
+
"norm_type": "spatial",
|
23 |
+
"num_vq_embeddings": 16384,
|
24 |
+
"out_channels": 3,
|
25 |
+
"sample_size": 32,
|
26 |
+
"scaling_factor": 0.18215,
|
27 |
+
"up_block_types": [
|
28 |
+
"AttnUpDecoderBlock2D",
|
29 |
+
"UpDecoderBlock2D",
|
30 |
+
"UpDecoderBlock2D",
|
31 |
+
"UpDecoderBlock2D"
|
32 |
+
],
|
33 |
+
"vq_embed_dim": 4
|
34 |
+
}
|
models/kandinsky-2-2-decoder/movq/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:efb05eb02828bd06b46d4f0fd3bc05fd8c6c0e7803067b20d58c91900e5a820a
|
3 |
+
size 135714846
|
models/kandinsky-2-2-decoder/prior_image_encoder/config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "C:\\Users\\edesa\\.cache\\huggingface\\hub\\models--kandinsky-community--kandinsky-2-2-prior\\snapshots\\9fc51ad5732afc5d031724219d22e6c42179c5a8\\image_encoder",
|
3 |
+
"architectures": [
|
4 |
+
"CLIPVisionModelWithProjection"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"dropout": 0.0,
|
8 |
+
"hidden_act": "gelu",
|
9 |
+
"hidden_size": 1664,
|
10 |
+
"image_size": 224,
|
11 |
+
"initializer_factor": 1.0,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 8192,
|
14 |
+
"layer_norm_eps": 1e-05,
|
15 |
+
"model_type": "clip_vision_model",
|
16 |
+
"num_attention_heads": 16,
|
17 |
+
"num_channels": 3,
|
18 |
+
"num_hidden_layers": 48,
|
19 |
+
"patch_size": 14,
|
20 |
+
"projection_dim": 1280,
|
21 |
+
"torch_dtype": "float16",
|
22 |
+
"transformers_version": "4.35.2"
|
23 |
+
}
|
models/kandinsky-2-2-decoder/prior_image_encoder/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dabf125eaf7f339da6b900a7a14f8190f02913b7d46cab80e09cd0755c4ce39c
|
3 |
+
size 3689910512
|
models/kandinsky-2-2-decoder/prior_image_processor/preprocessor_config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"crop_size": {
|
3 |
+
"height": 224,
|
4 |
+
"width": 224
|
5 |
+
},
|
6 |
+
"do_center_crop": true,
|
7 |
+
"do_convert_rgb": true,
|
8 |
+
"do_normalize": true,
|
9 |
+
"do_rescale": true,
|
10 |
+
"do_resize": true,
|
11 |
+
"feature_extractor_type": "CLIPFeatureExtractor",
|
12 |
+
"image_mean": [
|
13 |
+
0.48145466,
|
14 |
+
0.4578275,
|
15 |
+
0.40821073
|
16 |
+
],
|
17 |
+
"image_processor_type": "CLIPImageProcessor",
|
18 |
+
"image_std": [
|
19 |
+
0.26862954,
|
20 |
+
0.26130258,
|
21 |
+
0.27577711
|
22 |
+
],
|
23 |
+
"resample": 3,
|
24 |
+
"rescale_factor": 0.00392156862745098,
|
25 |
+
"size": {
|
26 |
+
"shortest_edge": 224
|
27 |
+
},
|
28 |
+
"use_square_size": false
|
29 |
+
}
|
models/kandinsky-2-2-decoder/prior_prior/config.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "PriorTransformer",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"_name_or_path": "C:\\Users\\edesa\\.cache\\huggingface\\hub\\models--kandinsky-community--kandinsky-2-2-prior\\snapshots\\9fc51ad5732afc5d031724219d22e6c42179c5a8\\prior",
|
5 |
+
"added_emb_type": "prd",
|
6 |
+
"additional_embeddings": 4,
|
7 |
+
"attention_head_dim": 64,
|
8 |
+
"clip_embed_dim": null,
|
9 |
+
"dropout": 0.0,
|
10 |
+
"embedding_dim": 1280,
|
11 |
+
"embedding_proj_dim": null,
|
12 |
+
"embedding_proj_norm_type": null,
|
13 |
+
"encoder_hid_proj_type": "linear",
|
14 |
+
"norm_in_type": null,
|
15 |
+
"num_attention_heads": 32,
|
16 |
+
"num_embeddings": 77,
|
17 |
+
"num_layers": 20,
|
18 |
+
"time_embed_act_fn": "silu",
|
19 |
+
"time_embed_dim": null
|
20 |
+
}
|
models/kandinsky-2-2-decoder/prior_prior/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fa935a029f07936321ea2922f21cc7904f3260c92785ec61ad6adaa6f2de369b
|
3 |
+
size 2052488952
|
models/kandinsky-2-2-decoder/prior_scheduler/scheduler_config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "UnCLIPScheduler",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"beta_schedule": "squaredcos_cap_v2",
|
5 |
+
"clip_sample": true,
|
6 |
+
"clip_sample_range": 10.0,
|
7 |
+
"num_train_timesteps": 1000,
|
8 |
+
"prediction_type": "sample",
|
9 |
+
"variance_type": "fixed_small_log"
|
10 |
+
}
|
models/kandinsky-2-2-decoder/prior_text_encoder/config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "C:\\Users\\edesa\\.cache\\huggingface\\hub\\models--kandinsky-community--kandinsky-2-2-prior\\snapshots\\9fc51ad5732afc5d031724219d22e6c42179c5a8\\text_encoder",
|
3 |
+
"architectures": [
|
4 |
+
"CLIPTextModelWithProjection"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"dropout": 0.0,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"hidden_act": "gelu",
|
11 |
+
"hidden_size": 1280,
|
12 |
+
"initializer_factor": 1.0,
|
13 |
+
"initializer_range": 0.02,
|
14 |
+
"intermediate_size": 5120,
|
15 |
+
"layer_norm_eps": 1e-05,
|
16 |
+
"max_position_embeddings": 77,
|
17 |
+
"model_type": "clip_text_model",
|
18 |
+
"num_attention_heads": 20,
|
19 |
+
"num_hidden_layers": 32,
|
20 |
+
"pad_token_id": 1,
|
21 |
+
"projection_dim": 1280,
|
22 |
+
"torch_dtype": "float16",
|
23 |
+
"transformers_version": "4.35.2",
|
24 |
+
"vocab_size": 49408
|
25 |
+
}
|
models/kandinsky-2-2-decoder/prior_text_encoder/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ec310df2af79c318e24d20511b601a591ca8cd4f1fce1d8dff822a356bcdb1f4
|
3 |
+
size 1389382176
|
models/kandinsky-2-2-decoder/prior_tokenizer/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
models/kandinsky-2-2-decoder/prior_tokenizer/special_tokens_map.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|startoftext|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|endoftext|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": "<|endoftext|>",
|
17 |
+
"unk_token": {
|
18 |
+
"content": "<|endoftext|>",
|
19 |
+
"lstrip": false,
|
20 |
+
"normalized": true,
|
21 |
+
"rstrip": false,
|
22 |
+
"single_word": false
|
23 |
+
}
|
24 |
+
}
|
models/kandinsky-2-2-decoder/prior_tokenizer/tokenizer_config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"49406": {
|
5 |
+
"content": "<|startoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": true,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"49407": {
|
13 |
+
"content": "<|endoftext|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": true,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
}
|
20 |
+
},
|
21 |
+
"bos_token": "<|startoftext|>",
|
22 |
+
"clean_up_tokenization_spaces": true,
|
23 |
+
"do_lower_case": true,
|
24 |
+
"eos_token": "<|endoftext|>",
|
25 |
+
"errors": "replace",
|
26 |
+
"model_max_length": 77,
|
27 |
+
"pad_token": "<|endoftext|>",
|
28 |
+
"tokenizer_class": "CLIPTokenizer",
|
29 |
+
"unk_token": "<|endoftext|>"
|
30 |
+
}
|
models/kandinsky-2-2-decoder/prior_tokenizer/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
models/kandinsky-2-2-decoder/scheduler/scheduler_config.json
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "DDPMScheduler",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"beta_end": 0.012,
|
5 |
+
"beta_schedule": "linear",
|
6 |
+
"beta_start": 0.00085,
|
7 |
+
"clip_sample": true,
|
8 |
+
"clip_sample_range": 1.0,
|
9 |
+
"dynamic_thresholding_ratio": 0.995,
|
10 |
+
"num_train_timesteps": 1000,
|
11 |
+
"prediction_type": "epsilon",
|
12 |
+
"sample_max_value": 1.0,
|
13 |
+
"set_alpha_to_one": false,
|
14 |
+
"steps_offset": 1,
|
15 |
+
"thresholding": false,
|
16 |
+
"timestep_spacing": "leading",
|
17 |
+
"trained_betas": null,
|
18 |
+
"variance_type": "fixed_small"
|
19 |
+
}
|
models/kandinsky-2-2-decoder/unet/config.json
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "UNet2DConditionModel",
|
3 |
+
"_diffusers_version": "0.24.0",
|
4 |
+
"_name_or_path": "C:\\Users\\edesa\\.cache\\huggingface\\hub\\models--kandinsky-community--kandinsky-2-2-decoder\\snapshots\\9ae140d347fed8ce6e8bb3005dcc1f48543bb8e3\\unet",
|
5 |
+
"act_fn": "silu",
|
6 |
+
"addition_embed_type": "image",
|
7 |
+
"addition_embed_type_num_heads": 64,
|
8 |
+
"addition_time_embed_dim": null,
|
9 |
+
"attention_head_dim": 64,
|
10 |
+
"attention_type": "default",
|
11 |
+
"block_out_channels": [
|
12 |
+
384,
|
13 |
+
768,
|
14 |
+
1152,
|
15 |
+
1536
|
16 |
+
],
|
17 |
+
"center_input_sample": false,
|
18 |
+
"class_embed_type": null,
|
19 |
+
"class_embeddings_concat": false,
|
20 |
+
"conv_in_kernel": 3,
|
21 |
+
"conv_out_kernel": 3,
|
22 |
+
"cross_attention_dim": 768,
|
23 |
+
"cross_attention_norm": null,
|
24 |
+
"down_block_types": [
|
25 |
+
"ResnetDownsampleBlock2D",
|
26 |
+
"SimpleCrossAttnDownBlock2D",
|
27 |
+
"SimpleCrossAttnDownBlock2D",
|
28 |
+
"SimpleCrossAttnDownBlock2D"
|
29 |
+
],
|
30 |
+
"downsample_padding": 1,
|
31 |
+
"dropout": 0.0,
|
32 |
+
"dual_cross_attention": false,
|
33 |
+
"encoder_hid_dim": 1280,
|
34 |
+
"encoder_hid_dim_type": "image_proj",
|
35 |
+
"flip_sin_to_cos": true,
|
36 |
+
"freq_shift": 0,
|
37 |
+
"in_channels": 4,
|
38 |
+
"layers_per_block": 3,
|
39 |
+
"mid_block_only_cross_attention": null,
|
40 |
+
"mid_block_scale_factor": 1,
|
41 |
+
"mid_block_type": "UNetMidBlock2DSimpleCrossAttn",
|
42 |
+
"norm_eps": 1e-05,
|
43 |
+
"norm_num_groups": 32,
|
44 |
+
"num_attention_heads": null,
|
45 |
+
"num_class_embeds": null,
|
46 |
+
"only_cross_attention": false,
|
47 |
+
"out_channels": 8,
|
48 |
+
"projection_class_embeddings_input_dim": null,
|
49 |
+
"resnet_out_scale_factor": 1.0,
|
50 |
+
"resnet_skip_time_act": false,
|
51 |
+
"resnet_time_scale_shift": "scale_shift",
|
52 |
+
"reverse_transformer_layers_per_block": null,
|
53 |
+
"sample_size": 64,
|
54 |
+
"time_cond_proj_dim": null,
|
55 |
+
"time_embedding_act_fn": null,
|
56 |
+
"time_embedding_dim": null,
|
57 |
+
"time_embedding_type": "positional",
|
58 |
+
"timestep_post_act": null,
|
59 |
+
"transformer_layers_per_block": 1,
|
60 |
+
"up_block_types": [
|
61 |
+
"SimpleCrossAttnUpBlock2D",
|
62 |
+
"SimpleCrossAttnUpBlock2D",
|
63 |
+
"SimpleCrossAttnUpBlock2D",
|
64 |
+
"ResnetUpsampleBlock2D"
|
65 |
+
],
|
66 |
+
"upcast_attention": false,
|
67 |
+
"use_linear_projection": false
|
68 |
+
}
|
models/kandinsky-2-2-decoder/unet/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd317b5be472665cef98ed37ffe42016a5c4490c282e6f0c2b11205c3953a013
|
3 |
+
size 2506194800
|
requirements.txt
CHANGED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
diffusers
|
2 |
+
transformers
|
3 |
+
--extra-index-url https://download.pytorch.org/whl/cu113
|
4 |
+
torch
|
5 |
+
gradio
|
6 |
+
PIL
|
7 |
+
requests
|
8 |
+
safetensors
|