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 authored and eliteprox committed Aug 9, 2024
1 parent 072ac62 commit 8f13c97
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions runner/app/pipelines/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,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 @@ -198,7 +204,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 8f13c97

Please sign in to comment.