Spaces:
Sleeping
Sleeping
Update app.py
Browse files25 unmodified lines262728292930313270 unmodified lines10310410510610610710810985 unmodified lines19519619719819920020125 unmodified lines if base_model_name_or_path is None: raise ValueError("Please specify the base model name or path") pipe = StableDiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype) pipe = DiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype) before_params = pipe.unet.parameters() pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name) pipe.unet.set_adapter(adapter_name)70 unmodified lines # добавляем обновление pipe по условию if model_repo_id != model_id_default: pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype).to(device) pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype).to(device) prompt_embeds = process_prompt(prompt, pipe.tokenizer, pipe.text_encoder) negative_prompt_embeds = process_prompt(negative_prompt, pipe.tokenizer, pipe.text_encoder) prompt_embeds, negative_prompt_embeds = align_embeddings(prompt_embeds, negative_prompt_embeds)85 unmodified lines info="Choose model", visible=True, allow_custom_value=True,# value=model_repo_id, value=model_id_default, ) app.py+3-2