support network mul from prompt

This commit is contained in:
Kohya S
2023-02-19 18:43:35 +09:00
parent e45e272e9d
commit d94c0d70fe
2 changed files with 73 additions and 19 deletions

View File

@@ -126,6 +126,11 @@ class LoRANetwork(torch.nn.Module):
assert lora.lora_name not in names, f"duplicated lora name: {lora.lora_name}"
names.add(lora.lora_name)
def set_multiplier(self, multiplier):
self.multiplier = multiplier
for lora in self.text_encoder_loras + self.unet_loras:
lora.multiplier = self.multiplier
def load_weights(self, file):
if os.path.splitext(file)[1] == '.safetensors':
from safetensors.torch import load_file, safe_open