multimodalart HF Staff commited on
Commit
2f91598
·
verified ·
1 Parent(s): f1e196a

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -71,8 +71,12 @@ def generate(
71
  seed = random.randint(0, MAX_SEED)
72
  seed = int(seed)
73
 
74
- # Apply / adjust LoRA strength — adapter name is "default_0" after load_lora_weights
75
- adapter_names = list(pipe.get_list_adapters() or ["default_0"])
 
 
 
 
76
  pipe.set_adapters(adapter_names, adapter_weights=[float(lora_strength)] * len(adapter_names))
77
 
78
  generator = torch.Generator(device=device).manual_seed(seed)
 
71
  seed = random.randint(0, MAX_SEED)
72
  seed = int(seed)
73
 
74
+ # Apply / adjust LoRA strength — load_lora_weights names the adapter "default_0"
75
+ adapters = pipe.get_list_adapters()
76
+ if adapters:
77
+ adapter_names = list(adapters.values())
78
+ else:
79
+ adapter_names = ["default_0"]
80
  pipe.set_adapters(adapter_names, adapter_weights=[float(lora_strength)] * len(adapter_names))
81
 
82
  generator = torch.Generator(device=device).manual_seed(seed)