From cb5d39756ecce1825063aa3f290e2412bc9e3bc8 Mon Sep 17 00:00:00 2001 From: Shi Hui Date: Mon, 15 Apr 2024 16:36:34 +0800 Subject: [PATCH] Added the check for reserved model uid like "instances", "prompts" etc. Because if you use these name, it will conflict with describe model function. --- xinference/core/supervisor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xinference/core/supervisor.py b/xinference/core/supervisor.py index c8837f7a84..8eefe4b39d 100644 --- a/xinference/core/supervisor.py +++ b/xinference/core/supervisor.py @@ -57,6 +57,8 @@ ASYNC_LAUNCH_TASKS = {} # type: ignore +RESERVED_MODEL_UIDS = ["prompts", "families", "vllm-supported", "instances"] + def callback_for_async_launch(model_uid: str): ASYNC_LAUNCH_TASKS.pop(model_uid, None) @@ -747,6 +749,11 @@ async def launch_builtin_model( if model_uid is None: model_uid = self._gen_model_uid(model_name) + else: + if model_uid in RESERVED_MODEL_UIDS: + raise ValueError( + f"Model uid cannot be the reserved name: '{model_uid}'." + ) model_size = str(model_size_in_billions) if model_size_in_billions else "" logger.debug(