From fd42730363542125eb43f7b789e2a580469867ed Mon Sep 17 00:00:00 2001 From: shh2000 <13820618441@163.com> Date: Tue, 29 Aug 2023 13:14:22 +0800 Subject: [PATCH 1/2] support special packages --- docs/dev/inference-case-doc.md | 2 ++ inference/utils/prepare_in_container.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/dev/inference-case-doc.md b/docs/dev/inference-case-doc.md index 829428011..e1ccdb0ca 100644 --- a/docs/dev/inference-case-doc.md +++ b/docs/dev/inference-case-doc.md @@ -205,6 +205,8 @@ exist_compiler_path: null 对于某些case,如需要镜像本身以外的pip包,可在benchmarks/<case\>/\下添加requirements.txt,框架启动时会自动在运行此次评测的镜像中安装 +对于部分厂商适配case,如果需要与标准case不同,且不能包含在厂商dockerfile中的包(例如,yolov5标准case依赖于pycocotools2.0.4,厂商A只接受pycocotools2.0.7),则可以在同目录下添加\_requirements.txt(如nvidia\_requirements.txt)。框架在自动安装时如果检测到对应vendor的文件,则会**忽略标准case的“requirements.txt,只安装该厂商指定的\\_requirements.txt**。 + ##### 3.2.1 config 对于标准case、需要组织的是configurations.yaml、parameters.yaml,及vendor_config/nvidia_configurations.yaml。 diff --git a/inference/utils/prepare_in_container.py b/inference/utils/prepare_in_container.py index b2fe4fe03..eef9c2cec 100644 --- a/inference/utils/prepare_in_container.py +++ b/inference/utils/prepare_in_container.py @@ -46,8 +46,14 @@ def install_requriements(vendor, model, framework, pipsource): framework_path = os.path.join(case_path, framework_name) req_file = os.path.join(framework_path, "requirements.txt") - print(req_file) - env_file = os.path.join(framework_path, "environment_variables.sh") + + vendor_filename = vendor + "requirements.txt" + vendor_req_file = os.path.join(framework_path, vendor_filename) + if os.path.exists(vendor_req_file): + req_file = vendor_req_file + + env_file = os.path.join(framework_path, "environment_variables.sh") + if not os.path.isfile(req_file): print("requirenments file ", req_file, " doesn't exist. Do nothing.") return 0 From e6bb0c3e91c9a775f5457897cae9c8903ef69911 Mon Sep 17 00:00:00 2001 From: SHIHONGHAO <13820618441@163.com> Date: Tue, 29 Aug 2023 14:24:10 +0800 Subject: [PATCH 2/2] Update prepare_in_container.py --- inference/utils/prepare_in_container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inference/utils/prepare_in_container.py b/inference/utils/prepare_in_container.py index eef9c2cec..11a1ee226 100644 --- a/inference/utils/prepare_in_container.py +++ b/inference/utils/prepare_in_container.py @@ -47,7 +47,7 @@ def install_requriements(vendor, model, framework, pipsource): req_file = os.path.join(framework_path, "requirements.txt") - vendor_filename = vendor + "requirements.txt" + vendor_filename = vendor + "_requirements.txt" vendor_req_file = os.path.join(framework_path, vendor_filename) if os.path.exists(vendor_req_file): req_file = vendor_req_file