Skip to content

Commit e73c22a

Browse files
authored
Use model cache for text2sql docker compose test. (opea-project#1436)
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent d8b491c commit e73c22a

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

.github/workflows/_comps-workflow.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
description: "Whether the test range is CI, CD or CICD"
3333
required: false
3434
type: string
35+
use_model_cache:
36+
default: false
37+
description: "use model cache true or false"
38+
required: false
39+
type: boolean
3540

3641
jobs:
3742
####################################################################################################
@@ -111,6 +116,7 @@ jobs:
111116
with:
112117
tag: ${{ inputs.tag }}
113118
service: ${{ inputs.service }}
119+
use_model_cache: ${{ inputs.use_model_cache }}
114120
secrets: inherit
115121

116122
####################################################################################################

.github/workflows/_run-docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ on:
2020
description: Example to test
2121
required: true
2222
type: string
23+
use_model_cache:
24+
default: false
25+
required: false
26+
type: boolean
27+
2328
jobs:
2429
get-test-case:
2530
runs-on: ubuntu-latest
@@ -96,10 +101,19 @@ jobs:
96101
service: ${{ inputs.service }}
97102
test_case: ${{ matrix.test_case }}
98103
hardware: ${{ matrix.hardware }}
104+
use_model_cache: ${{ inputs.use_model_cache }}
99105
run: |
100106
cd ${{ github.workspace }}/tests
101107
service=$(echo "${test_case}" | cut -d'/' -f3 | cut -d'_' -f2- |cut -d'.' -f1)
102108
echo "service=${service}" >> $GITHUB_ENV
109+
if [[ "$use_model_cache" == "true" ]]; then
110+
if [ -d "/data2/hf_model" ]; then
111+
export model_cache="/data2/hf_model"
112+
else
113+
echo "Model cache directory /data2/huggingface does not exist"
114+
export model_cache="~/.cache/huggingface/hub"
115+
fi
116+
fi
103117
if [ -f ${test_case} ]; then timeout 60m bash ${test_case}; else echo "Test script {${test_case}} not found, skip test!"; fi
104118
105119
- name: Clean up container

.github/workflows/manual-comps-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ on:
3535
description: "Whether the test range is CI, CD or CICD"
3636
required: false
3737
type: string
38+
use_model_cache:
39+
default: false
40+
description: "use model cache true or false"
41+
required: false
42+
type: boolean
3843

3944
permissions: read-all
4045

.github/workflows/pr-microservice-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ jobs:
7676
run: |
7777
cd tests
7878
echo "log_name=${service}" >> $GITHUB_ENV
79+
if [ -d "/data2/hf_model" ]; then
80+
export model_cache="/data2/hf_model"
81+
else
82+
echo "Model cache directory /data2/huggingface does not exist"
83+
export model_cache="~/.cache/huggingface/hub"
84+
fi
7985
timeout 60m bash $(find . -type f -name test_${service}.sh)
8086
8187
- name: Clean up container

tests/text2sql/test_text2sql.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash
22
# Copyright (C) 2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -7,7 +7,7 @@ set -x
77
WORKPATH=$(dirname "$PWD")
88
LOG_PATH="$WORKPATH/tests"
99
ip_address=$(hostname -I | awk '{print $1}')
10-
DATA_PATH=$WORKPATH/data
10+
export DATA_PATH=${model_cache:-./data}
1111

1212
export TAG='comps'
1313

tests/text2sql/test_text2sql_on_intel_hpu.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash
22
# Copyright (C) 2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -8,7 +8,7 @@ WORKPATH=$(dirname "$PWD")
88
LOG_PATH="$WORKPATH/tests"
99
ip_address=$(hostname -I | awk '{print $1}')
1010

11-
export DATA_PATH=$WORKPATH/data
11+
export DATA_PATH=${model_cache:-./data}
1212

1313
export TAG='comps'
1414

0 commit comments

Comments
 (0)