|
2 | 2 |
|
3 | 3 | set -x |
4 | 4 |
|
5 | | -mkdir -p /etc/pim/models/fraud_detection |
| 5 | +[ -f /etc/pim/tritonserver.conf ] || touch /etc/pim/tritonserver.conf |
6 | 6 |
|
7 | | -[ -f /etc/pim/fraud_detection.conf ] || touch /etc/pim/fraud_detection.conf |
| 7 | +# List of AI applications to be served from tritonserver |
| 8 | +ai_apps=("fraud") |
8 | 9 |
|
9 | | -mkdir -p /var/models/fraud_detection |
10 | | -mkdir -p /var/models/fraud_detection/model_repository/fraud/1 |
| 10 | +for app in "${ai_apps[@]}"; do |
| 11 | + mkdir -p /var/models/model_repository/${app}/1 |
11 | 12 |
|
12 | | -ONNX_MODEL_SOURCE=$(jq -r '.modelSource' /etc/pim/pim_config.json) |
13 | | -# Download model from the http server |
14 | | -if [[ -n "$ONNX_MODEL_SOURCE" ]]; then |
15 | | - curl "$ONNX_MODEL_SOURCE" --output /var/models/fraud_detection/model_repository/fraud/1/model.onnx |
16 | | -fi |
| 13 | + ONNX_MODEL_SOURCE=$(jq -r '.modelSource' /etc/pim/pim_config.json) |
| 14 | + if [[ -n "$ONNX_MODEL_SOURCE" ]]; then |
| 15 | + curl "$ONNX_MODEL_SOURCE" --output /var/models/model_repository/${app}/1/model.onnx |
| 16 | + fi |
17 | 17 |
|
18 | | -CONFIG_FILE=$(jq -r '.configSource' /etc/pim/pim_config.json) |
19 | | -if [[ -n "$CONFIG_FILE" ]]; then |
20 | | - curl "$CONFIG_FILE" --output /var/models/fraud_detection/model_repository/fraud/config.pbtxt |
21 | | -fi |
| 18 | + CONFIG_FILE=$(jq -r '.configSource' /etc/pim/pim_config.json) |
| 19 | + if [[ -n "$CONFIG_FILE" ]]; then |
| 20 | + curl "$CONFIG_FILE" --output /var/models/model_repository/${app}/config.pbtxt |
| 21 | + fi |
| 22 | +done |
22 | 23 |
|
23 | | -var_to_add=MODEL_REPOSITORY=/var/models/fraud_detection/model_repository |
24 | | -sed -i "/^MODEL_REPOSITORY=.*/d" /etc/pim/fraud_detection.conf && echo "$var_to_add" >> /etc/pim/fraud_detection.conf |
| 24 | +var_to_add=MODEL_REPOSITORY=/var/models/model_repository |
| 25 | +sed -i "/^MODEL_REPOSITORY=.*/d" /etc/pim/tritonserver.conf && echo "$var_to_add" >> /etc/pim/tritonserver.conf |
0 commit comments