Skip to content

Commit

Permalink
add inference test for llama-2-7b-chat-hf and mpt-7b-chat with hpu (#201
Browse files Browse the repository at this point in the history
)

Signed-off-by: jiafu zhang <jiafu.zhang@intel.com>
Co-authored-by: chen, suyue <suyue.chen@intel.com>
  • Loading branch information
jiafuzha and chensuyue committed Sep 1, 2023
1 parent e0c510b commit 5c4f5e8
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/chatbot-inference-llama-2-7b-chat-hf-hpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Chatbot inference on llama-2-7b-chat-hf with hpu

on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-inf-lla-7b-hpu
cancel-in-progress: true

jobs:
inference:
name: inference test
runs-on: guadi2-4
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ~/itrex-actions-runner/_work/intel-extension-for-transformers/intel-extension-for-transformers/workflows/chatbot

- name: Checkout
uses: actions/checkout@v2

- name: Load environment variables
run: cat ~/itrex-actions-runner/.env >> $GITHUB_ENV

- name: Build Docker Image
run: docker build ./ --target hpu -f workflows/chatbot/inference/docker/Dockerfile -t chatbotinfer-hpu:latest && yes | docker container prune && yes | docker image prune

- name: Start Docker Container
run: |
cid=$(docker ps -q --filter "name=chatbotinfer-hpu")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi
docker run -tid -v /mnt/DP_disk1/huggingface/cache/:/root/.cache/huggingface/hub -v .:/root/chatbot --name="chatbotinfer-hpu" --hostname="chatbotinfer-hpu-container" chatbotinfer-hpu:latest
- name: Run Inference Test
run: |
docker exec "chatbotinfer-hpu" bash -c "cd /root/chatbot && source activate && conda activate chatbot-demo; python workflows/chatbot/inference/generate.py --base_model_path \"meta-llama/Llama-2-7b-chat-hf\" --hf_access_token \"${{ env.HF_ACCESS_TOKEN }}\" --habana --use_hpu_graphs --instructions \"Transform the following sentence into one that shows contrast. The tree is rotten.\" "
- name: Stop Container
if: success() || failure()
run: |
cid=$(docker ps -q --filter "name=chatbotinfer-hpu")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi
- name: Test Summary
run: echo "Inference completed successfully"
41 changes: 41 additions & 0 deletions .github/workflows/chatbot-inference-mpt-7b-chat-hpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Chatbot inference on mosaicml/mpt-7b-chat with hpu

on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-inf-mpt-7b-hpu
cancel-in-progress: true

jobs:
inference:
name: inference test
runs-on: guadi2-4
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ~/itrex-actions-runner/_work/intel-extension-for-transformers/intel-extension-for-transformers/workflows/chatbot

- name: Checkout
uses: actions/checkout@v2

- name: Build Docker Image
run: docker build ./ --target hpu -f workflows/chatbot/inference/docker/Dockerfile -t chatbotinfer-hpu:latest && yes | docker container prune && yes | docker image prune

- name: Start Docker Container
run: |
cid=$(docker ps -q --filter "name=chatbotinfer-hpu")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi
docker run -tid -v /mnt/DP_disk1/huggingface/cache/:/root/.cache/huggingface/hub -v .:/root/chatbot --name="chatbotinfer-hpu" --hostname="chatbotinfer-hpu-container" chatbotinfer-hpu:latest
- name: Run Inference Test
run: |
docker exec "chatbotinfer-hpu" bash -c "cd /root/chatbot && source activate && conda activate chatbot-demo; python workflows/chatbot/inference/generate.py --base_model_path \"mosaicml/mpt-7b-chat\" --habana --use_hpu_graphs --instructions \"Transform the following sentence into one that shows contrast. The tree is rotten.\" "
- name: Stop Container
if: success() || failure()
run: |
cid=$(docker ps -q --filter "name=chatbotinfer-hpu")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi
- name: Test Summary
run: echo "Inference completed successfully"
8 changes: 8 additions & 0 deletions .github/workflows/chatbot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- '.github/workflows/chatbot-inference-llama-2-7b-chat-hf.yml'
- '.github/workflows/chatbot-inference-mpt-7b-chat.yml'
- '.github/workflows/chatbot-finetune-mpt-7b-chat.yml'
- '.github/workflows/chatbot-inference-llama-2-7b-chat-hf-hpu.yml'
- '.github/workflows/chatbot-inference-mpt-7b-chat-hpu.yml'
- '.github/workflows/chatbot-finetune-mpt-7b-chat-hpu.yml'
- '.github/workflows/script/chatbot/**'
- '.github/workflows/sample_data/**'
Expand All @@ -36,6 +38,12 @@ jobs:
call-finetune-mpt-7b-chat:
uses: ./.github/workflows/chatbot-finetune-mpt-7b-chat.yml

call-inference-llama-2-7b-chat-hf-hpu:
uses: ./.github/workflows/chatbot-inference-llama-2-7b-chat-hf-hpu.yml

call-inference-mpt-7b-chat-hpu:
uses: ./.github/workflows/chatbot-inference-mpt-7b-chat-hpu.yml

call-finetune-mpt-7b-chat-hpu:
uses: ./.github/workflows/chatbot-finetune-mpt-7b-chat-hpu.yml

0 comments on commit 5c4f5e8

Please sign in to comment.