Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxin Zhang <[email protected]>
  • Loading branch information
VincyZhang committed May 14, 2024
1 parent 87b5445 commit 3175d61
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/model_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
matrix:
include:
- modelName: "facebook/opt-125m"
- modelName: "opt-125m"
datasets: "piqa"
device: "cpu"
tasks: "text-generation"
Expand All @@ -45,6 +45,11 @@ jobs:
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*

- name: Load environment variables
if: ${{ matrix.device }} == "cpu"
run:
cat ~/actions-runner4/.env >> $GITHUB_ENV

- name: Checkout out Repo
uses: actions/checkout@v4
Expand All @@ -54,7 +59,7 @@ jobs:
# We need this because GitHub needs to clone the branch to pipeline
- name: Docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/common.dockerfile -t ${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }} .
docker build -f ${{ github.workspace }}/.github/workflows/docker/common.dockerfile --build-arg http_proxy="${{ env.HTTP_PROXY_IMAGE_BUILD }}" --build-arg https_proxy="${{ env.HTTPS_PROXY_IMAGE_BUILD }}" -t ${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }} .
- name: Docker Run
run: |
Expand All @@ -64,6 +69,7 @@ jobs:
fi
docker run -dit --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }} -v /dev/shm:/dev/shm \
-v ${{ github.workspace }}:/GenAIEval \
-e http_proxy="${{ env.HTTP_PROXY_IMAGE_BUILD }}" -e https_proxy="${{ env.HTTPS_PROXY_IMAGE_BUILD }}" \
${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }}
- name: Binary build
Expand Down Expand Up @@ -102,7 +108,7 @@ jobs:
&& bash -x collect_log.sh --model=${{ matrix.modelName }} \
--device=${{ matrix.device }} \
--datasets=${{ matrix.datasets }} \
--tasks=${{ matrix.tasks }}
--tasks=${{ matrix.tasks }}"
- name: Publish pipeline artifact
uses: actions/upload-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scripts/models/collect_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

set -eo pipefail
set -x
source /GenAIEval/.github/workflows/scripts/change_color
WORKSPACE="/GenAIEval"
# get parameters
Expand All @@ -34,7 +35,7 @@ for i in "$@"; do
esac
done

log_file="/GenAIEval/${device}/${model}/${device}-${model}-${tasks}-${datasets}.log"
log_file="/GenAIEval/${device}/${model}/${device}-${tasks}-${datasets}.log"
$BOLD_YELLOW && echo "-------- Collect logs --------" && $RESET

echo "working in"
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/scripts/models/model_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail
set -o pipefail
set -x
source /GenAIEval/.github/workflows/scripts/change_color

# get parameters
Expand All @@ -34,11 +35,7 @@ for i in "$@"; do
esac
done

log_dir="/GenAIEval/${device}/${model}"
mkdir -p ${log_dir}
working_dir=""
$BOLD_YELLOW && echo "-------- evaluation start --------" && $RESET

main() {
case ${tasks} in
"text-generation")
Expand All @@ -48,6 +45,14 @@ main() {
*)
echo "Not suppotted task"; exit 1;;
esac
if [[ ${model} == *"opt"* ]]; then
pretrained="facebook/${model}"
else
pretrained="${model}"
fi
log_dir="/GenAIEval/${device}/${model}"
mkdir -p ${log_dir}
$BOLD_YELLOW && echo "-------- evaluation start --------" && $RESET
run_benchmark
}

Expand All @@ -69,10 +74,10 @@ function prepare() {

function run_benchmark() {
cd ${working_dir}
overall_log="${log_dir}/${device}-${model}-${tasks}-${datasets}.log"
overall_log="${log_dir}/${device}-${tasks}-${datasets}.log"
python main.py \
--model hf \
--model_args pretrained=${model} \
--model_args pretrained=${pretrained} \
--tasks ${datasets} \
--device ${device} \
--batch_size 112
Expand Down

0 comments on commit 3175d61

Please sign in to comment.