Skip to content

Commit

Permalink
Integrated portrait_generator_v001 512x512 diffusion model
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Letts committed Jul 14, 2022
1 parent 68c37c0 commit d6d68b0
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
32 changes: 28 additions & 4 deletions Disco_Diffusion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"id": "TitleTop"
},
"source": [
"# Disco Diffusion v5.5 - Now with Pixel Art Diffusion, Watercolor, Pulp Sci-Fi, and OpenCLIP models\n",
"# Disco Diffusion v5.6 - Now with portrait_generator_v001\n",
"\n",
"Disco Diffusion - http://discodiffusion.com/ , https://github.com/alembics/disco-diffusion\n",
"\n",
Expand Down Expand Up @@ -74,7 +74,9 @@
"\n",
"Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models from KaliYuga (https://twitter.com/KaliYuga_ai). Follow KaliYuga's Twitter for the latest models and for notebooks with specialized settings.\n",
"\n",
"Integration of OpenCLIP models and initiation of integration of KaliYuga models by Palmweaver / Chris Scalf (https://twitter.com/ChrisScalf11)"
"Integration of OpenCLIP models and initiation of integration of KaliYuga models by Palmweaver / Chris Scalf (https://twitter.com/ChrisScalf11)\n",
"\n",
"Integrated portrait_generator_v001 from Felipe3DArtist (https://twitter.com/Felipe3DArtist)"
]
},
{
Expand Down Expand Up @@ -319,6 +321,10 @@
" Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models\n",
"\n",
" cut_ic_pow scheduling\n",
"\n",
" v5.6 Update: Jul 13th 2022 - Felipe3DArtist integration by gandamu / Adam Letts\n",
"\n",
" portrait_generator_v001 diffusion model integrated\n",
" '''\n",
" )"
],
Expand Down Expand Up @@ -1869,7 +1875,7 @@
},
"source": [
"#@markdown ####**Models Settings (note: For pixel art, the best is pixelartdiffusion_expanded):**\n",
"diffusion_model = \"512x512_diffusion_uncond_finetune_008100\" #@param [\"256x256_diffusion_uncond\", \"512x512_diffusion_uncond_finetune_008100\", \"pixelartdiffusion_expanded\", \"pixel_art_diffusion_hard_256\", \"pixel_art_diffusion_soft_256\", \"pixelartdiffusion4k\", \"watercolordiffusion_2\", \"watercolordiffusion\", \"PulpSciFiDiffusion\", \"custom\"]\n",
"diffusion_model = \"512x512_diffusion_uncond_finetune_008100\" #@param [\"256x256_diffusion_uncond\", \"512x512_diffusion_uncond_finetune_008100\", \"portrait_generator_v001\", \"pixelartdiffusion_expanded\", \"pixel_art_diffusion_hard_256\", \"pixel_art_diffusion_soft_256\", \"pixelartdiffusion4k\", \"watercolordiffusion_2\", \"watercolordiffusion\", \"PulpSciFiDiffusion\", \"custom\"]\n",
"\n",
"use_secondary_model = True #@param {type: 'boolean'}\n",
"diffusion_sampling_mode = 'ddim' #@param ['plms','ddim']\n",
Expand Down Expand Up @@ -1909,6 +1915,7 @@
"diff_model_map = {\n",
" '256x256_diffusion_uncond': { 'downloaded': False, 'sha': 'a37c32fffd316cd494cf3f35b339936debdc1576dad13fe57c42399a5dbc78b1', 'uri_list': ['https://openaipublic.blob.core.windows.net/diffusion/jul-2021/256x256_diffusion_uncond.pt', 'https://www.dropbox.com/s/9tqnqo930mpnpcn/256x256_diffusion_uncond.pt'] },\n",
" '512x512_diffusion_uncond_finetune_008100': { 'downloaded': False, 'sha': '9c111ab89e214862b76e1fa6a1b3f1d329b1a88281885943d2cdbe357ad57648', 'uri_list': ['https://the-eye.eu/public/AI/models/512x512_diffusion_unconditional_ImageNet/512x512_diffusion_uncond_finetune_008100.pt', 'https://huggingface.co/lowlevelware/512x512_diffusion_unconditional_ImageNet/resolve/main/512x512_diffusion_uncond_finetune_008100.pt'] },\n",
" 'portrait_generator_v001': { 'downloaded': False, 'sha': 'b7e8c747af880d4480b6707006f1ace000b058dd0eac5bb13558ba3752d9b5b9', 'uri_list': ['https://huggingface.co/felipe3dartist/portrait_generator_v001/resolve/main/portrait_generator_v001_ema_0.9999_1MM.pt'] },\n",
" 'pixelartdiffusion_expanded': { 'downloaded': False, 'sha': 'a73b40556634034bf43b5a716b531b46fb1ab890634d854f5bcbbef56838739a', 'uri_list': ['https://huggingface.co/KaliYuga/PADexpanded/resolve/main/PADexpanded.pt'] },\n",
" 'pixel_art_diffusion_hard_256': { 'downloaded': False, 'sha': 'be4a9de943ec06eef32c65a1008c60ad017723a4d35dc13169c66bb322234161', 'uri_list': ['https://huggingface.co/KaliYuga/pixel_art_diffusion_hard_256/resolve/main/pixel_art_diffusion_hard_256.pt'] },\n",
" 'pixel_art_diffusion_soft_256': { 'downloaded': False, 'sha': 'd321590e46b679bf6def1f1914b47c89e762c76f19ab3e3392c8ca07c791039c', 'uri_list': ['https://huggingface.co/KaliYuga/pixel_art_diffusion_soft_256/resolve/main/pixel_art_diffusion_soft_256.pt'] },\n",
Expand Down Expand Up @@ -2003,6 +2010,23 @@
" 'use_fp16': not useCPU,\n",
" 'use_scale_shift_norm': True,\n",
" })\n",
"elif diffusion_model == 'portrait_generator_v001':\n",
" model_config.update({\n",
" 'attention_resolutions': '32, 16, 8',\n",
" 'class_cond': False,\n",
" 'diffusion_steps': 1000,\n",
" 'rescale_timesteps': True,\n",
" 'image_size': 512,\n",
" 'learn_sigma': True,\n",
" 'noise_schedule': 'linear',\n",
" 'num_channels': 128,\n",
" 'num_heads': 4,\n",
" 'num_res_blocks': 2,\n",
" 'resblock_updown': True,\n",
" 'use_checkpoint': use_checkpoint,\n",
" 'use_fp16': True,\n",
" 'use_scale_shift_norm': True,\n",
" })\n",
"else: # E.g. A model finetuned by KaliYuga\n",
" model_config.update({\n",
" 'attention_resolutions': '16',\n",
Expand Down Expand Up @@ -3330,7 +3354,7 @@
"FlowFns2"
],
"machine_shape": "hm",
"name": "Disco Diffusion v5.5 [Now with Pixel Art Diffusion, Watercolor, Pulp Sci-Fi, and OpenCLIP models]",
"name": "Disco Diffusion v5.6 [Now with portrait_generator_v001]",
"private_outputs": true,
"provenance": [],
"include_colab_link": true
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ the tool being used is called [Colab-Convert](https://github.com/MSFTserver/cola
* Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models
* cut_ic_pow scheduling

#### v5.6 Update: Jul 13th 2022 - Felipe3DArtist, integration by gandamu / Adam Letts

* Integrated portrait_generator_v001 - 512x512 diffusion model trained on faces - from Felipe3DArtist

## Notebook Provenance

Original notebook by Katherine Crowson (https://github.com/crowsonkb, https://twitter.com/RiversHaveWings). It uses either OpenAI's 256x256 unconditional ImageNet or Katherine Crowson's fine-tuned 512x512 diffusion model (https://github.com/openai/guided-diffusion), together with CLIP (https://github.com/openai/CLIP) to connect text prompts with images.
Expand Down Expand Up @@ -126,3 +130,5 @@ Warp and custom model support by Alex Spirin (https://twitter.com/devdef).
Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models from KaliYuga (https://twitter.com/KaliYuga_ai). Follow KaliYuga's Twitter for the latest models and for notebooks with specialized settings.

Integration of OpenCLIP models and initiation of integration of KaliYuga models by Palmweaver / Chris Scalf (https://twitter.com/ChrisScalf11)

Integrated portrait_generator_v001 from Felipe3DArtist (https://twitter.com/Felipe3DArtist)
30 changes: 27 additions & 3 deletions disco.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# !! "id": "TitleTop"
# !! }}
"""
# Disco Diffusion v5.5 - Now with Pixel Art Diffusion, Watercolor, Pulp Sci-Fi, and OpenCLIP models
# Disco Diffusion v5.6 - Now with portrait_generator_v001
Disco Diffusion - http://discodiffusion.com/ , https://github.com/alembics/disco-diffusion
Expand Down Expand Up @@ -69,6 +69,8 @@
Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models from KaliYuga (https://twitter.com/KaliYuga_ai). Follow KaliYuga's Twitter for the latest models and for notebooks with specialized settings.
Integration of OpenCLIP models and initiation of integration of KaliYuga models by Palmweaver / Chris Scalf (https://twitter.com/ChrisScalf11)
Integrated portrait_generator_v001 from Felipe3DArtist (https://twitter.com/Felipe3DArtist)
"""

# %%
Expand Down Expand Up @@ -308,6 +310,10 @@
Pixel Art Diffusion, Watercolor Diffusion, and Pulp SciFi Diffusion models
cut_ic_pow scheduling
v5.6 Update: Jul 13th 2022 - Felipe3DArtist integration by gandamu / Adam Letts
portrait_generator_v001 diffusion model integrated
'''
)

Expand Down Expand Up @@ -1819,7 +1825,7 @@ def forward(self, input, t):
# !! "id": "ModelSettings"
# !! }}
#@markdown ####**Models Settings (note: For pixel art, the best is pixelartdiffusion_expanded):**
diffusion_model = "512x512_diffusion_uncond_finetune_008100" #@param ["256x256_diffusion_uncond", "512x512_diffusion_uncond_finetune_008100", "pixelartdiffusion_expanded", "pixel_art_diffusion_hard_256", "pixel_art_diffusion_soft_256", "pixelartdiffusion4k", "watercolordiffusion_2", "watercolordiffusion", "PulpSciFiDiffusion", "custom"]
diffusion_model = "512x512_diffusion_uncond_finetune_008100" #@param ["256x256_diffusion_uncond", "512x512_diffusion_uncond_finetune_008100", "portrait_generator_v001", "pixelartdiffusion_expanded", "pixel_art_diffusion_hard_256", "pixel_art_diffusion_soft_256", "pixelartdiffusion4k", "watercolordiffusion_2", "watercolordiffusion", "PulpSciFiDiffusion", "custom"]

use_secondary_model = True #@param {type: 'boolean'}
diffusion_sampling_mode = 'ddim' #@param ['plms','ddim']
Expand Down Expand Up @@ -1859,6 +1865,7 @@ def forward(self, input, t):
diff_model_map = {
'256x256_diffusion_uncond': { 'downloaded': False, 'sha': 'a37c32fffd316cd494cf3f35b339936debdc1576dad13fe57c42399a5dbc78b1', 'uri_list': ['https://openaipublic.blob.core.windows.net/diffusion/jul-2021/256x256_diffusion_uncond.pt', 'https://www.dropbox.com/s/9tqnqo930mpnpcn/256x256_diffusion_uncond.pt'] },
'512x512_diffusion_uncond_finetune_008100': { 'downloaded': False, 'sha': '9c111ab89e214862b76e1fa6a1b3f1d329b1a88281885943d2cdbe357ad57648', 'uri_list': ['https://the-eye.eu/public/AI/models/512x512_diffusion_unconditional_ImageNet/512x512_diffusion_uncond_finetune_008100.pt', 'https://huggingface.co/lowlevelware/512x512_diffusion_unconditional_ImageNet/resolve/main/512x512_diffusion_uncond_finetune_008100.pt'] },
'portrait_generator_v001': { 'downloaded': False, 'sha': 'b7e8c747af880d4480b6707006f1ace000b058dd0eac5bb13558ba3752d9b5b9', 'uri_list': ['https://huggingface.co/felipe3dartist/portrait_generator_v001/resolve/main/portrait_generator_v001_ema_0.9999_1MM.pt'] },
'pixelartdiffusion_expanded': { 'downloaded': False, 'sha': 'a73b40556634034bf43b5a716b531b46fb1ab890634d854f5bcbbef56838739a', 'uri_list': ['https://huggingface.co/KaliYuga/PADexpanded/resolve/main/PADexpanded.pt'] },
'pixel_art_diffusion_hard_256': { 'downloaded': False, 'sha': 'be4a9de943ec06eef32c65a1008c60ad017723a4d35dc13169c66bb322234161', 'uri_list': ['https://huggingface.co/KaliYuga/pixel_art_diffusion_hard_256/resolve/main/pixel_art_diffusion_hard_256.pt'] },
'pixel_art_diffusion_soft_256': { 'downloaded': False, 'sha': 'd321590e46b679bf6def1f1914b47c89e762c76f19ab3e3392c8ca07c791039c', 'uri_list': ['https://huggingface.co/KaliYuga/pixel_art_diffusion_soft_256/resolve/main/pixel_art_diffusion_soft_256.pt'] },
Expand Down Expand Up @@ -1953,6 +1960,23 @@ def download_model(diffusion_model_name, uri_index=0):
'use_fp16': not useCPU,
'use_scale_shift_norm': True,
})
elif diffusion_model == 'portrait_generator_v001':
model_config.update({
'attention_resolutions': '32, 16, 8',
'class_cond': False,
'diffusion_steps': 1000,
'rescale_timesteps': True,
'image_size': 512,
'learn_sigma': True,
'noise_schedule': 'linear',
'num_channels': 128,
'num_heads': 4,
'num_res_blocks': 2,
'resblock_updown': True,
'use_checkpoint': use_checkpoint,
'use_fp16': True,
'use_scale_shift_norm': True,
})
else: # E.g. A model finetuned by KaliYuga
model_config.update({
'attention_resolutions': '16',
Expand Down Expand Up @@ -3223,7 +3247,7 @@ def move_files(start_num, end_num, old_folder, new_folder):
# !! "FlowFns2"
# !! ],
# !! "machine_shape": "hm",
# !! "name": "Disco Diffusion v5.5 [Now with Pixel Art Diffusion, Watercolor, Pulp Sci-Fi, and OpenCLIP models]",
# !! "name": "Disco Diffusion v5.6 [Now with portrait_generator_v001]",
# !! "private_outputs": true,
# !! "provenance": [],
# !! "include_colab_link": true
Expand Down

1 comment on commit d6d68b0

@ElizabethQing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

groups of trees,soil,skeleton,conneted,tree root,gray,depressive

Please sign in to comment.