Skip to content

Commit

Permalink
test: CI convert llama3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoangthuan99 committed Aug 11, 2024
1 parent 8c3392b commit 42ffbeb
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/convert-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ on:

env:
USER_NAME: cortexso
SOURCE_MODEL_ID: google/gemma-2-2b-it #${{ inputs.source_model_id }}
SOURCE_MODEL_SIZE: 2b #${{ inputs.source_model_size }}
TARGET_MODEL_ID: gemma2 #${{ inputs.target_model_id }}
SOURCE_MODEL_ID: meta-llama/Meta-Llama-3-8B-Instruct #${{ inputs.source_model_id }}
SOURCE_MODEL_SIZE: 8b #${{ inputs.source_model_size }}
TARGET_MODEL_ID: llama3.1 #${{ inputs.target_model_id }}
PRECISION: int4 # Valid values: int4,fp16,fp3
EXECUTOR: dml # Valid values: cpu,cuda,dml,web
ONNXRUNTIME_GENAI_VERSION: 0.3.0 # Check version from: https://github.com/microsoft/onnxruntime-genai/releases

jobs:
converter:
runs-on: windows-cuda-12-0
runs-on: windows-onnx
steps:
- name: Checkout
uses: actions/checkout@v4 # v4.1.7
Expand Down Expand Up @@ -95,16 +95,19 @@ jobs:
echo "EXECUTOR: ${{ env.EXECUTOR }}"
echo "MODEL_NAME: ${{ env.MODEL_NAME }}"
- name: Prepare folders
run: |
mkdir -p ${{ env.MODEL_NAME }}/hf
mkdir -p ${{ env.MODEL_NAME }}/onnx
mkdir -p ${{ env.MODEL_NAME }}/cache
# - name: Prepare folders
# run: |
# mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/hf
# mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/onnx
# mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/cache


- name: Download Hugging Face model
if: ${{ hashFiles("C:\\models\\$${{ env.MODEL_NAME }}/hf") != '' }}
run: |
mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/hf
mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/onnx
mkdir -p C:\\models\\$${{ env.MODEL_NAME }}/cache
huggingface-cli login --token ${{ secrets.HUGGINGFACE_TOKEN_READ }} --add-to-git-credential
huggingface-cli download --repo-type model --local-dir ${{ env.MODEL_NAME }}/hf ${{ env.SOURCE_MODEL_ID }}
huggingface-cli logout
Expand All @@ -121,14 +124,14 @@ jobs:
shell: powershell
run: |
huggingface-cli login --token ${{ secrets.HUGGINGFACE_TOKEN_READ }} --add-to-git-credential
python3 "onnxruntime-genai/src/python/py/models/builder.py" -i "${{ env.MODEL_NAME }}/hf" -o "${{ env.MODEL_NAME }}/onnx" -p ${{ env.PRECISION }} -e ${{ env.EXECUTOR }}
python3 "onnxruntime-genai/src/python/py/models/builder.py" -i "C:\\models\\${{ env.MODEL_NAME }}/hf" -o "C:\\models\\$${{ env.MODEL_NAME }}/onnx" -p ${{ env.PRECISION }} -e ${{ env.EXECUTOR }}
huggingface-cli logout
- name: Upload to Hugging Face
run: |
Get-ChildItem -Path "${{ env.MODEL_NAME }}/onnx" -Force
Get-ChildItem -Path "C:\\models\\$${{ env.MODEL_NAME }}/onnx" -Force
huggingface-cli login --token ${{ secrets.HUGGINGFACE_TOKEN_WRITE }} --add-to-git-credential
huggingface-cli upload ${{ env.USER_NAME }}/${{ env.TARGET_MODEL_ID }} "${{ env.MODEL_NAME }}/onnx" . --revision "${{ env.SOURCE_MODEL_SIZE }}-onnx"
huggingface-cli upload ${{ env.USER_NAME }}/${{ env.TARGET_MODEL_ID }} "C:\\models\\$${{ env.MODEL_NAME }}/onnx" . --revision "${{ env.SOURCE_MODEL_SIZE }}-onnx"
huggingface-cli logout
- name: Cleanup
Expand Down

0 comments on commit 42ffbeb

Please sign in to comment.