Skip to content

Commit

Permalink
Added the check for reserved model uid like "instances", "prompts" etc.
Browse files Browse the repository at this point in the history
Because if you use these name, it will conflict with describe model function.
  • Loading branch information
mikeshi80 committed Apr 15, 2024
1 parent e3a947e commit cb5d397
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xinference/core/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit cb5d397

Please sign in to comment.