From f5253298654fce56156c2750c6184f7b967ddfe8 Mon Sep 17 00:00:00 2001 From: Tosin Segun Date: Wed, 28 Jun 2023 19:04:12 +0000 Subject: [PATCH] Reading from score file --- mii/config.py | 2 +- mii/deployment.py | 4 ++-- mii/models/score/score_template.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mii/config.py b/mii/config.py index 1e74df85..954cecd7 100644 --- a/mii/config.py +++ b/mii/config.py @@ -134,6 +134,6 @@ class Deployment(BaseModel): enable_deepspeed: bool = True enable_zero: bool = True GPU_index_map: dict = None - mii_config: dict = None + mii_config: MIIConfig = None ds_config: dict = None version: int = 1 diff --git a/mii/deployment.py b/mii/deployment.py index c0175c09..a8998a9e 100644 --- a/mii/deployment.py +++ b/mii/deployment.py @@ -67,8 +67,8 @@ def deploy(task=None, If deployment_type is `LOCAL`, returns just the name of the deployment that can be used to create a query handle using `mii.mii_query_handle(deployment_name)` """ - if len(deployments == 0): - assert model is not None and task is not None and deployment_name is not None, "model, task, and deployment name must be set to deploy sigular model" + if not deployments: + assert all((model, task, deployment_name)), "model, task, and deployment name must be set to deploy singular model" deployments = [Deployment(deployment_name, task, model, enable_deepspeed, enable_zero, None, mii_config, ds_config, version)] deployment_tag = deployment_name + "_tag" else: diff --git a/mii/models/score/score_template.py b/mii/models/score/score_template.py index 80c220df..0681ac2f 100644 --- a/mii/models/score/score_template.py +++ b/mii/models/score/score_template.py @@ -17,7 +17,9 @@ def init(): model_path = mii.utils.full_model_path(configs[mii.constants.MODEL_PATH_KEY]) deployment_tag = configs[mii.constants.DEPLOYMENT_TAG_KEY] - deployments = mii.multi_model_deployments[deployment_tag] + deployments = [] + for deployment in configs.values(): + deployments.append(Deployment(deployment[mii.constants.DEPLOYMENT_NAME_KEY], deployment[mii.constants.TASK_NAME_KEY], deployment[mii.constants.DEPLOYMENT_MODEL_NAME_KEY], deloyment[mii.constants.ENABLE_DEEPSPEED_KEY], deployment[mii.constants.ENABLE_DEEPSPEED_ZERO_KEY], None, deployment[mii.constants.MII_CONFIGS_KEY], deployment[mii.constants.DS_CONFIG_KEY], 1)) deployment_name = configs[mii.constants.DEPLOYMENT_NAME_KEY] model_name = configs[mii.constants.MODEL_NAME_KEY]