From 66e3752b29b587a9d7d195ac154a014708a23d83 Mon Sep 17 00:00:00 2001 From: Bangqi Zhu Date: Tue, 25 Jun 2024 22:55:35 -0700 Subject: [PATCH] adapter adding validation Signed-off-by: Bangqi Zhu --- presets/inference/text-generation/inference_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/presets/inference/text-generation/inference_api.py b/presets/inference/text-generation/inference_api.py index 137ec0e7b..4a99e36b9 100644 --- a/presets/inference/text-generation/inference_api.py +++ b/presets/inference/text-generation/inference_api.py @@ -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