Unverified Commit 915c5378 authored by apolinário's avatar apolinário Committed by GitHub
Browse files

Revert error to warning when loading LoRA from repo with multiple weights (#11568)

parent 8270fa58
...@@ -299,8 +299,8 @@ def _best_guess_weight_name( ...@@ -299,8 +299,8 @@ def _best_guess_weight_name(
targeted_files = list(filter(lambda x: x.endswith(LORA_WEIGHT_NAME_SAFE), targeted_files)) targeted_files = list(filter(lambda x: x.endswith(LORA_WEIGHT_NAME_SAFE), targeted_files))
if len(targeted_files) > 1: if len(targeted_files) > 1:
raise ValueError( logger.warning(
f"Provided path contains more than one weights file in the {file_extension} format. Either specify `weight_name` in `load_lora_weights` or make sure there's only one `.safetensors` or `.bin` file in {pretrained_model_name_or_path_or_dict}." f"Provided path contains more than one weights file in the {file_extension} format. `{targeted_files[0]}` is going to be loaded, for precise control, specify a `weight_name` in `load_lora_weights`."
) )
weight_name = targeted_files[0] weight_name = targeted_files[0]
return weight_name return weight_name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment