Skip to content

Commit

Permalink
fix env setup
Browse files Browse the repository at this point in the history
Signed-off-by: Sun, Xuehao <[email protected]>
  • Loading branch information
XuehaoSun committed Jul 1, 2024
1 parent 1b47a5e commit 145472a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions .azure-pipelines/scripts/models/env_setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/bin/bash
set -eo pipefail
cd /neural-compressor
source .azure-pipelines/scripts/change_color.sh
PATTERN='[-a-zA-Z0-9_]*='

for i in "$@"; do
case $i in
--model=*)
model=${i//${PATTERN}/}
;;
*)
echo "Parameter $i not recognized."
exit 1
;;
esac
done

CONFIG_PATH="/neural-compressor/examples/.config/model_params_onnxrt.json"
model_src_dir=$(jq -r ".\"onnxrt\".\"$model\".\"model_src_dir\"" "$CONFIG_PATH")

# log_dir="/neural-compressor/.azure-pipelines/scripts/models"

Expand All @@ -14,7 +28,11 @@ source .azure-pipelines/scripts/change_color.sh
# mkdir ${model}
# fi

$BOLD_YELLOW && echo "====== install requirements ======" && $RESET
$BOLD_YELLOW && echo "====== install ONC ======" && $RESET
cd /neural-compressor
source .azure-pipelines/scripts/change_color.sh
/bin/bash .azure-pipelines/scripts/install_nc.sh
cd "/neural-compressor/examples/nlp/huggingface_model/text_generation/llama/quantization/weight_only"

$BOLD_YELLOW && echo "====== install requirements ======" && $RESET
cd "/neural-compressor/examples/$model_src_dir"
pip install -r requirements.txt
2 changes: 1 addition & 1 deletion .azure-pipelines/template/model-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:

- script: |
docker exec ${{ parameters.modelContainerName }} bash -c \
"cd /neural-compressor/.azure-pipelines/scripts/models && bash env_setup.sh"
"cd /neural-compressor/.azure-pipelines/scripts/models && bash env_setup.sh --model=${{ parameters.modelName }}"
displayName: Env setup
- task: DownloadPipelineArtifact@2
Expand Down

0 comments on commit 145472a

Please sign in to comment.