diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index c21ef66656..f4efdd2a1e 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -32,6 +32,11 @@ on: description: "Whether the test range is CI, CD or CICD" required: false type: string + use_model_cache: + default: false + description: "use model cache true or false" + required: false + type: boolean jobs: #################################################################################################### @@ -111,6 +116,7 @@ jobs: with: tag: ${{ inputs.tag }} service: ${{ inputs.service }} + use_model_cache: ${{ inputs.use_model_cache }} secrets: inherit #################################################################################################### diff --git a/.github/workflows/_run-docker-compose.yml b/.github/workflows/_run-docker-compose.yml index cc49f5cb94..9cc24e439b 100644 --- a/.github/workflows/_run-docker-compose.yml +++ b/.github/workflows/_run-docker-compose.yml @@ -20,6 +20,11 @@ on: description: Example to test required: true type: string + use_model_cache: + default: false + required: false + type: boolean + jobs: get-test-case: runs-on: ubuntu-latest @@ -96,10 +101,19 @@ jobs: service: ${{ inputs.service }} test_case: ${{ matrix.test_case }} hardware: ${{ matrix.hardware }} + use_model_cache: ${{ inputs.use_model_cache }} run: | cd ${{ github.workspace }}/tests service=$(echo "${test_case}" | cut -d'/' -f3 | cut -d'_' -f2- |cut -d'.' -f1) echo "service=${service}" >> $GITHUB_ENV + if [[ "$use_model_cache" == "true" ]]; then + if [ -d "/data2/hf_model" ]; then + export model_cache="/data2/hf_model" + else + echo "Model cache directory /data2/huggingface does not exist" + export model_cache="~/.cache/huggingface/hub" + fi + fi if [ -f ${test_case} ]; then timeout 60m bash ${test_case}; else echo "Test script {${test_case}} not found, skip test!"; fi - name: Clean up container diff --git a/.github/workflows/manual-comps-test.yml b/.github/workflows/manual-comps-test.yml index 435e0b368b..6ef2ca43e4 100644 --- a/.github/workflows/manual-comps-test.yml +++ b/.github/workflows/manual-comps-test.yml @@ -35,6 +35,11 @@ on: description: "Whether the test range is CI, CD or CICD" required: false type: string + use_model_cache: + default: false + description: "use model cache true or false" + required: false + type: boolean permissions: read-all diff --git a/.github/workflows/pr-microservice-test.yml b/.github/workflows/pr-microservice-test.yml index e32a13df07..4c7be7cf6c 100644 --- a/.github/workflows/pr-microservice-test.yml +++ b/.github/workflows/pr-microservice-test.yml @@ -66,6 +66,12 @@ jobs: run: | cd tests echo "log_name=${service}" >> $GITHUB_ENV + if [ -d "/data2/hf_model" ]; then + export model_cache="/data2/hf_model" + else + echo "Model cache directory /data2/huggingface does not exist" + export model_cache="~/.cache/huggingface/hub" + fi timeout 60m bash $(find . -type f -name test_${service}.sh) - name: Clean up container diff --git a/tests/text2sql/test_text2sql.sh b/tests/text2sql/test_text2sql.sh index fb663b4a06..cdda1ca290 100644 --- a/tests/text2sql/test_text2sql.sh +++ b/tests/text2sql/test_text2sql.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 @@ -7,7 +7,7 @@ set -x WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') -DATA_PATH=$WORKPATH/data +export DATA_PATH=${model_cache:-./data} export TAG='comps' diff --git a/tests/text2sql/test_text2sql_on_intel_hpu.sh b/tests/text2sql/test_text2sql_on_intel_hpu.sh index 143cb528e2..a5583d9d54 100644 --- a/tests/text2sql/test_text2sql_on_intel_hpu.sh +++ b/tests/text2sql/test_text2sql_on_intel_hpu.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 @@ -8,7 +8,7 @@ WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') -export DATA_PATH=$WORKPATH/data +export DATA_PATH=${model_cache:-./data} export TAG='comps'