DiZH797 commited on
Commit
b157044
·
verified ·
1 Parent(s): 397415d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -60,15 +60,17 @@ def get_pipe(model_id: str, lora_scale: float = 1.0):
60
  )
61
  pipe.fuse_lora(lora_scale=lora_scale)
62
  # После загрузки LoRA
63
- print("Loaded LoRA weights:")
 
64
  for name, param in pipe.unet.named_parameters():
65
  if "lora" in name.lower() and param.requires_grad:
66
- print(f"LoRA layer: {name}, shape: {param.shape}")
67
  break
68
  print("LoRA layers in text_encoder:")
69
  for name, param in pipe.text_encoder.named_parameters():
70
  if "lora" in name:
71
  print(f"Text Encoder LoRA: {name}, shape: {param.shape}")
 
72
  else:
73
  # Load a standard model without LoRA
74
  pipe = DiffusionPipeline.from_pretrained(
@@ -162,7 +164,7 @@ with gr.Blocks(css=css) as demo:
162
  # опциональный селектор scheduler
163
  scheduler_select = gr.Dropdown(
164
  label="Scheduler (optional)",
165
- choices=["", "DDIM", "EulerAncestral", "PNDM"],
166
  value="",
167
  )
168
 
@@ -170,7 +172,7 @@ with gr.Blocks(css=css) as demo:
170
  lora_scale_slider = gr.Slider(
171
  label="LoRA Scale (Only for LoRA model)",
172
  minimum=0.0,
173
- maximum=2.0,
174
  step=0.1,
175
  value=0.7,
176
  visible=False, # Initially hidden
 
60
  )
61
  pipe.fuse_lora(lora_scale=lora_scale)
62
  # После загрузки LoRA
63
+ print("LoRa scale is", lora_scale)
64
+ print("LoRA layers in unet:")
65
  for name, param in pipe.unet.named_parameters():
66
  if "lora" in name.lower() and param.requires_grad:
67
+ print(f"Unet LoRA layer: {name}, shape: {param.shape}")
68
  break
69
  print("LoRA layers in text_encoder:")
70
  for name, param in pipe.text_encoder.named_parameters():
71
  if "lora" in name:
72
  print(f"Text Encoder LoRA: {name}, shape: {param.shape}")
73
+ break
74
  else:
75
  # Load a standard model without LoRA
76
  pipe = DiffusionPipeline.from_pretrained(
 
164
  # опциональный селектор scheduler
165
  scheduler_select = gr.Dropdown(
166
  label="Scheduler (optional)",
167
+ choices=["", "DDIM", "EulerAncestral", "PNDM", "DPMSMS"],
168
  value="",
169
  )
170
 
 
172
  lora_scale_slider = gr.Slider(
173
  label="LoRA Scale (Only for LoRA model)",
174
  minimum=0.0,
175
+ maximum=3.0,
176
  step=0.1,
177
  value=0.7,
178
  visible=False, # Initially hidden