Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(diffusers): LoRA adapters, handle several base models #454

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docker_images/diffusers/app/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def _load_textual_embeddings(self, adapter, model_data):
logger.info("Text embeddings loaded for adapter %s", adapter)
else:
logger.info(
"No text embeddings were loaded due to invalid embeddings or a mismatch of token sizes for adapter %s",
"No text embeddings were loaded due to invalid embeddings or a mismatch of token sizes "
"for adapter %s",
adapter,
)
self.current_tokens_loaded = tokens_to_add
Expand All @@ -157,7 +158,9 @@ def _load_lora_adapter(self, kwargs):
logger.error(msg)
raise ValueError(msg)
base_model = model_data.cardData["base_model"]
if self.model_id != base_model:
if (
isinstance(base_model, list) and (self.model_id not in base_model)
) or (self.model_id != base_model):
msg = f"Requested adapter {adapter:s} is not a LoRA adapter for base model {self.model_id:s}"
logger.error(msg)
raise ValueError(msg)
Expand Down
Loading