Skip to content

Commit

Permalink
Add another sanity check to load_loras
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk-dev committed Jul 16, 2024
1 parent 436c105 commit 6544ef0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions runner/app/pipelines/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ def load_loras(pipeline: any, requested_loras: str):
if requested_loras == "" or requested_loras == None:
return;
# Parse LoRas param as JSON to extract key-value pairs
loras = json.loads(requested_loras)
try:
loras = json.loads(requested_loras)
except Exception as e:
logger.warning(
"Unable to parse '" + requested_loras + "' as JSON. Continuing inference without loading LoRas"
)
return
# Build a list of adapter names and their requested strength
adapters = []
strengths = []
Expand All @@ -156,7 +162,6 @@ def load_loras(pipeline: any, requested_loras: str):
logger.warning(
"Skipping requested LoRa " + adapter + ", as it's requested strength (" + val + ") is not a number"
)
# NOTE: do we want to drop skipped LoRas from loaded_loras?
continue
if strength < 0.0:
logger.warning(
Expand Down

0 comments on commit 6544ef0

Please sign in to comment.