This commit is contained in:
space-nuko
2023-05-16 08:57:20 -05:00
parent e115e00d59
commit c548be7071
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ diff_model_map = {
'concept_art_generator_v000-1_alpha': { 'downloaded': False, 'sha': '0c0394148b4fb56234baee533c36f17202b8f936f28427a957f342aa2f18d040', 'uri_list': ['https://huggingface.co/WAS/concept_art_generator/resolve/main/concept_art_generator_v000-1_alpha.pt'] },
'concept_art_generator_v000-2_alpha': { 'downloaded': False, 'sha': 'a7aee6b8dd73b6f3d377a8c579b99ed2922fc472ead16238074e08bf7517d075', 'uri_list': ['https://huggingface.co/WAS/concept_art_generator/resolve/main/concept_art_generator_v000-2_alpha.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'] },
# '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'] },
'portrait_generator_v002': { 'downloaded': False, 'sha': '3bc39e28fd9690dafbbee83cc08d089a3640eca8ed4d14280c4a9d342c56fd7f', 'uri_list': ['https://huggingface.co/WAS/portrait-diffusion/resolve/main/ema_0.9999_165000.pt'] },
'portrait_generator_v003': { 'downloaded': False, 'sha': 'c0e1739731efe682f6429f2f7f905104b602b415ef8bf0b507034cce6050e8e3', 'uri_list': ['https://huggingface.co/WAS/portrait-diffusion/resolve/main/ema_0.9999_430000.pt'] },
'portrait_generator_v004': { 'downloaded': False, 'sha': '09daed35b70670b8491f27ef172e2a62f08f3a78326aeb88d23cade1fbb878ab', 'uri_list': ['https://huggingface.co/WAS/portrait-diffusion/resolve/main/ema_0.9999_080000.pt'] },
+11
View File
@@ -47,6 +47,17 @@ class OpenAICLIPLoader:
def load(self, model_name):
device = comfy.model_management.get_torch_device()
# For my own notes (because I was confused about this earlier):
# DD requires the use of torch.autograd.grad so it can steer the output
# image towards CLIP embeddings by calculating loss.
# But it's more efficient to load tensors without support for calculating loss
# because most people aren't training models, they're just running inference.
# And "torch.autograd.grad" is a function mostly used for training models.
# But because (this implementation of) guided diffusion requires autograd,
# we have to load the tensors with inference mode off ourselves (ComfyUI
# enables it by default, for maximum performance).
# Same with the guided diffusion model, secondary diffusion model and
# sampling code, it all must be run with support for autograd (inference mode off).
with torch.inference_mode(False):
if model_name in OPENAI_CLIP_MODELS:
download_root = os.path.join(folder_paths.models_dir, "OpenAI-CLIP")