Skip to content

Commit 252fd21

Browse files
Apply suggestions from code review
Co-authored-by: Benjamin Bossan <[email protected]>
1 parent 47cad58 commit 252fd21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diffusers/loaders/lora_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def _load_lora_into_text_encoder(
336336
raise ValueError("PEFT backend is required for this method.")
337337

338338
if network_alphas and metadata:
339-
raise ValueError("Both `network_alphas` and `metadata` cannot be specified.")
339+
raise ValueError("`network_alphas` and `metadata` cannot be specified both at the same time.")
340340

341341
peft_kwargs = {}
342342
if low_cpu_mem_usage:
@@ -423,7 +423,7 @@ def _load_lora_into_text_encoder(
423423
try:
424424
lora_config = LoraConfig(**lora_config_kwargs)
425425
except TypeError as e:
426-
raise TypeError(f"`LoraConfig` class could not be instantiated:\n{e}.")
426+
raise TypeError("`LoraConfig` class could not be instantiated.") from e
427427

428428
# adapter_name
429429
if adapter_name is None:
@@ -933,7 +933,7 @@ def write_lora_layers(
933933
if lora_adapter_metadata and not safe_serialization:
934934
raise ValueError("`lora_adapter_metadata` cannot be specified when not using `safe_serialization`.")
935935
if lora_adapter_metadata and not isinstance(lora_adapter_metadata, dict):
936-
raise ValueError("`lora_adapter_metadata` must be of type `dict`.")
936+
raise TypeError("`lora_adapter_metadata` must be of type `dict`.")
937937

938938
if save_function is None:
939939
if safe_serialization:

0 commit comments

Comments
 (0)