Skip to content

Commit

Permalink
feat(model): Add support for multiple versions of the same model (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsRuner authored Mar 8, 2024
1 parent 7446817 commit 04b6402
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dbgpt/model/cluster/worker/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ async def model_startup(self, startup_req: WorkerStartupRequest):
)
if not worker_params.model_name:
worker_params.model_name = model_name
assert model_name == worker_params.model_name
worker = _build_worker(worker_params)
command_args = _dict_to_command_args(params)
success = await self.run_blocking_func(
Expand All @@ -235,7 +234,9 @@ async def model_startup(self, startup_req: WorkerStartupRequest):
f"Unsupported worker type: {worker_type}, now supported worker type: {supported_types}"
)
start_apply_req = WorkerApplyRequest(
model=model_name, apply_type=WorkerApplyType.START, worker_type=worker_type
model=worker_params.model_name,
apply_type=WorkerApplyType.START,
worker_type=worker_type,
)
out: WorkerApplyOutput = None
try:
Expand Down Expand Up @@ -895,6 +896,8 @@ def _parse_worker_params(
**kwargs,
)
worker_params.update_from(new_worker_params)
if worker_params.model_alias:
worker_params.model_name = worker_params.model_alias

# logger.info(f"Worker params: {worker_params}")
return worker_params
Expand Down
4 changes: 4 additions & 0 deletions dbgpt/model/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ class ModelWorkerParameters(BaseModelParameters):
default=None,
metadata={"valid_values": WorkerType.values(), "help": "Worker type"},
)
model_alias: Optional[str] = field(
default=None,
metadata={"help": "model alias"},
)
worker_class: Optional[str] = field(
default=None,
metadata={"help": "Model worker class, dbgpt.model.cluster.DefaultModelWorker"},
Expand Down

0 comments on commit 04b6402

Please sign in to comment.