Spaces:
Runtime error
Runtime error
fix: minor fix
Browse files34 unmodified lines353637383940414272 unmodified lines1151161171181191201211221231241251261275 unmodified lines13313413513613713813914014114234 unmodified lines("Stable Diffusion V1.5", "runwayml/stable-diffusion-v1-5", 1),("Anything V3.0", "Linaqruf/anything-v3.0", 2),("Open Journey", "prompthero/openjourney", 1),("Eimis AnimeDiffusion", "eimiss/EimisAnimeDiffusion_1.0v", 2)("Dreamlike Photoreal 2.0", "dreamlike-art/dreamlike-photoreal-2.0", 1)("Redshift Diffusion", "nitrosocke/redshift-diffusion", 1)]72 unmodified lines}def get_model(name):keys = [k[0] for k in models]if name not in unet_cache:if name not in keys:raise ValueError(name)else:unet = UNet2DConditionModel.from_pretrained(models[keys.index(name)][1],subfolder="unet",torch_dtype=torch.float16,)5 unmodified linesg_lora = lora_cache[name]g_unet.set_attn_processor(CrossAttnProcessor())g_lora.reset()if torch.cuda.is_available():g_unet.to("cuda")g_lora.to("cuda")return g_unet, g_lora, models[keys.index(name)][2]# precache on huggingfacefor model in models:34 unmodified lines353637383940414272 unmodified lines1151161171181191201211221231241251261271285 unmodified lines13413513613713813914014114214314434 unmodified lines("Stable Diffusion V1.5", "runwayml/stable-diffusion-v1-5", 1),("Anything V3.0", "Linaqruf/anything-v3.0", 2),("Open Journey", "prompthero/openjourney", 1),("Eimis AnimeDiffusion", "eimiss/EimisAnimeDiffusion_1.0v", 2),("Dreamlike Photoreal 2.0", "dreamlike-art/dreamlike-photoreal-2.0", 1),("Redshift Diffusion", "nitrosocke/redshift-diffusion", 1)]72 unmodified lines}def get_model(name):local_models = models + alt_modelskeys = [k[0] for k in local_models]if name not in unet_cache:if name not in keys:raise ValueError(name)else:unet = UNet2DConditionModel.from_pretrained(local_models[keys.index(name)][1],subfolder="unet",torch_dtype=torch.float16,)5 unmodified linesg_lora = lora_cache[name]g_unet.set_attn_processor(CrossAttnProcessor())g_lora.reset()clip_skip = local_models[keys.index(name)][2]if torch.cuda.is_available():g_unet.to("cuda")g_lora.to("cuda")return g_unet, g_lora, clip_skip# precache on huggingfacefor model in models:
app.py+7-5