From 562262e8f6667bbe376dc9e645627a427eaebef7 Mon Sep 17 00:00:00 2001 From: Rustem Galiullin Date: Fri, 20 May 2022 13:17:55 +0400 Subject: [PATCH 1/3] fix error when deploying a model from mlflow Add `config_path` key to `copy_paths` to avoid `KeyError` when deploying from mlflow models in **onnx** flavor with `config.pbtxt` --- deploy/mlflow-triton-plugin/mlflow_triton/deployments.py | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py index cc5ecce24d..05e4625e47 100644 --- a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py +++ b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py @@ -302,6 +302,7 @@ def _get_copy_paths(self, artifact_path, name, flavor): model_file = onnx_meta_data.get('data', None) elif file.name == 'config.pbtxt': config_file = file.name + copy_paths['config_path'] = {} if model_file is None: for file in artifact_path.iterdir(): if file.suffix == '.onnx': From 602f471d671c89db9b216d5ebbbcabdea992d88c Mon Sep 17 00:00:00 2001 From: Rustem Galiullin Date: Wed, 1 Jun 2022 15:32:12 +0400 Subject: [PATCH 2/3] ensure model version folder is created for ensemble --- deploy/mlflow-triton-plugin/mlflow_triton/deployments.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py index 05e4625e47..2963886a2e 100644 --- a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py +++ b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py @@ -344,6 +344,9 @@ def _copy_files_to_triton_repo(self, artifact_path, name, flavor): shutil.copy(copy_paths[key]['from'], copy_paths[key]['to']) print("Copied", copy_paths[key]['from'], "to", copy_paths[key]['to']) + triton_deployment_dir = os.path.join(self.triton_model_repo, name) + version_folder = os.path.join(triton_deployment_dir, "1") + os.makedirs(version_folder, exist_ok=True) return copy_paths def _delete_deployment_files(self, name): From 48a8122885371304456eb4e8a21400ab6974aac3 Mon Sep 17 00:00:00 2001 From: Rustem Galiullin Date: Wed, 1 Jun 2022 15:34:12 +0400 Subject: [PATCH 3/3] copy labels.txt along when deploying an onnx model --- deploy/mlflow-triton-plugin/mlflow_triton/deployments.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py index 2963886a2e..42a1d08ef0 100644 --- a/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py +++ b/deploy/mlflow-triton-plugin/mlflow_triton/deployments.py @@ -303,6 +303,11 @@ def _get_copy_paths(self, artifact_path, name, flavor): elif file.name == 'config.pbtxt': config_file = file.name copy_paths['config_path'] = {} + elif file.suffix == '.txt' and file.stem != 'requirements': + copy_paths[file.stem] = { + 'from': file, + 'to': triton_deployment_dir + } if model_file is None: for file in artifact_path.iterdir(): if file.suffix == '.onnx':