Skip to content

Commit

Permalink
adapter adding validation
Browse files Browse the repository at this point in the history
Signed-off-by: Bangqi Zhu <[email protected]>
  • Loading branch information
Bangqi Zhu committed Jun 26, 2024
1 parent ee843a1 commit 66e3752
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions presets/inference/text-generation/inference_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def __post_init__(self): # validate parameters
# To avoid any potential future operations that use non-combined adapters
for adapter in adapter_names:
model.delete_adapter(adapter)

active_adapters = model.active_adapters
if len(active_adapters) != 1 or active_adapters[0] != "combined_adapter":
raise ValueError(f"Adpaters is input but not merged correctlly")
else:
print("Warning: Did not find any valid adapters mounted, using base model")
model = base_model
Expand Down

0 comments on commit 66e3752

Please sign in to comment.