Skip to content

Commit

Permalink
check for base model earlier in the adapter function (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
noyoshi authored Jan 19, 2024
1 parent 7e246d3 commit f96ac5f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/lorax_server/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ def load_adapter(self, adapter_id, adapter_source, adapter_index, api_token):
into model. Otherwise, the adapter weights are merged into the model
weights on the fly.
"""
if adapter_id == BASE_MODEL_ADAPTER_ID:
return

if not self.supports_adapter_loading:
raise ValueError("This model does not support adapter loading.")

if not self.dynamic_adapter_loading_enabled:
if adapter_id == BASE_MODEL_ADAPTER_ID:
return
else:
raise ValueError(f"This model was initialized with the adapter {self.adapter_id} "
f"and therefore does not support dynamic adapter loading. "
f"Please initialize a new model instance from the base model in "
f"order to use the dynamic adapter loading feature.")
raise ValueError(f"This model was initialized with the adapter {self.adapter_id} "
f"and therefore does not support dynamic adapter loading. "
f"Please initialize a new model instance from the base model in "
f"order to use the dynamic adapter loading feature.")

# If we are doing dynamic adapter loading, then we need to reset the weights
if adapter_id == self.adapter_id:
Expand Down

0 comments on commit f96ac5f

Please sign in to comment.