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..11a1ee226 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