#!/bin/sh # vim /usr/local/lib/python3.6/dist-packages/model_archiver/model_packaging_utils.py #-------------------------------------------------------------- #====================== 1. set config_files file ================== #-------------------------------------------------------------- # shellcheck disable=SC2006 # shellcheck disable=SC2030 # shellcheck disable=SC2046 #py_files=`find $(pwd)/ -type f -name "*.py"` && export_path="models-server/model-store" && #for var in ${py_files} #do # export_paths_str="${var},${export_paths_str}" #done #export_paths_str=${export_paths_str%?} #echo {"$export_paths_str"} if [ -d "$export_path" ]; then rm -rf "$export_path" && mkdir -p "$export_path" else mkdir -p "$export_path" fi if [ ! -d "$export_path" ]; then mkdir -p "$export_path" fi #-------------------------------------------------------------- #===================== 2. Generate Mar File ================== #-------------------------------------------------------------- # note delete __pycache__ rm -rf ./src/__pycache__ torch-model-archiver \ --model-name yolov5 \ --version 1.0 \ --serialized-file ./models_zoo/yolov5_model_zoo/yolov5x.pt \ --handler src/object_detector_handler.py \ --force \ --extra-files ../src_code \ --export-path "$export_path" \ --requirements-file requirements.txt #-------------------------------------------------------------- #================ 3. Generate Properties File ================ #-------------------------------------------------------------- echo "inference_address=http://0.0.0.0:8080" > ./models-server/model-store/yolov5_config.properties && echo "management_address=http://0.0.0.0:8081" >> ./models-server/model-store/yolov5_config.properties && echo "metrics_address=http://0.0.0.0:8082" >> ./models-server/model-store/yolov5_config.properties && echo "max_request_size=878837280" >> ./models-server/model-store/yolov5_config.properties && echo "install_py_dep_per_model=true" >> ./models-server/model-store/yolov5_config.properties #-------------------------------------------------------------- #============= 3. Generate Log Properties File =============== #-------------------------------------------------------------- cp ./config_files/yolov5_log4j2.xml ./models-server/model-store