-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Python Tests on Linux CI and Add a Nightly Pipeline (#136)
- Loading branch information
1 parent
e8433dc
commit 87f30d1
Showing
10 changed files
with
258 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: "Linux CPU x64 Nightly Build" | ||
|
||
# Run at 5:00 AM UTC every day | ||
# 9:00 PM PST | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 5 * * *" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
ort_dir: "onnxruntime-linux-x64-1.17.0" | ||
ort_zip: "onnxruntime-linux-x64-1.17.0.tgz" | ||
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.17.0/onnxruntime-linux-x64-1.17.0.tgz" | ||
jobs: | ||
job: | ||
runs-on: [ "self-hosted", "1ES.Pool=onnxruntime-genai-Ubuntu2204-AMD-CPU" ] | ||
steps: | ||
- name: Checkout OnnxRuntime GenAI repo | ||
uses: actions/checkout@v2 | ||
|
||
|
||
|
||
- name: Download OnnxRuntime | ||
run: | | ||
curl -L -o ${{ env.ort_zip }} ${{ env.ort_url }} | ||
- name: Unzip OnnxRuntime | ||
run: | | ||
tar -xzf ${{ env.ort_zip }} | ||
rm ${{ env.ort_zip }} | ||
- name: Rename OnnxRuntime to ort | ||
run: | | ||
mv ${{ env.ort_dir }} ort | ||
- name: Git Submodule Update | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Build with CMake and clang | ||
run: | | ||
set -e -x | ||
rm -rf build | ||
cmake --preset linux_clang_cpu_release | ||
cmake --build --preset linux_clang_cpu_release | ||
- name: Install the python wheel and test dependencies | ||
run: | | ||
python3 -m pip install build/clang_cpu/release/wheel/onnxruntime_genai*.whl | ||
python3 -m pip install -r test/python/requirements-nightly-cpu.txt --user | ||
- name: Get HuggingFace Token | ||
run: | | ||
az login --identity --username 63b63039-6328-442f-954b-5a64d124e5b4 | ||
HF_TOKEN=$(az keyvault secret show --vault-name anubissvcsecret --name ANUBIS-HUGGINGFACE-TOKEN --query value) | ||
echo "::add-mask::$HF_TOKEN" | ||
echo "HF_TOKEN=$HF_TOKEN" >> $GITHUB_ENV | ||
- name: Run the python tests | ||
run: | | ||
python3 test/python/test_onnxruntime_genai.py --cwd test/python --test_models test/test_models --e2e | ||
- name: Verify Build Artifacts | ||
if: always() | ||
run: | | ||
ls -l ${{ github.workspace }}/build | ||
- name: Upload Build Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: onnxruntime-genai-linux-cpu-x64 | ||
path: ${{ github.workspace }}/build/**/*.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
import logging | ||
import os | ||
import subprocess | ||
import sys | ||
from typing import Dict, List, Optional, Union | ||
|
||
|
||
def is_windows(): | ||
return sys.platform.startswith("win") | ||
|
||
|
||
def run_subprocess( | ||
args: List[str], | ||
cwd: Optional[Union[str, bytes, os.PathLike]] = None, | ||
capture: bool = False, | ||
dll_path: Optional[Union[str, bytes, os.PathLike]] = None, | ||
shell: bool = False, | ||
env: Dict[str, str] = {}, | ||
log: Optional[logging.Logger] = None, | ||
): | ||
if log: | ||
log.info(f"Running subprocess in '{cwd or os.getcwd()}'\n{args}") | ||
user_env = os.environ.copy() | ||
user_env.update(env) | ||
if dll_path: | ||
if is_windows(): | ||
user_env["PATH"] = dll_path + os.pathsep + user_env["PATH"] | ||
else: | ||
if "LD_LIBRARY_PATH" in user_env: | ||
user_env["LD_LIBRARY_PATH"] += os.pathsep + dll_path | ||
else: | ||
user_env["LD_LIBRARY_PATH"] = dll_path | ||
|
||
stdout, stderr = (subprocess.PIPE, subprocess.STDOUT) if capture else (None, None) | ||
completed_process = subprocess.run( | ||
args, | ||
cwd=cwd, | ||
check=True, | ||
stdout=stdout, | ||
stderr=stderr, | ||
env=user_env, | ||
shell=shell, | ||
) | ||
|
||
if log: | ||
log.debug( | ||
"Subprocess completed. Return code=" + str(completed_process.returncode) | ||
) | ||
return completed_process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-f https://download.pytorch.org/whl/torch_stable.html | ||
torch==2.2.1+cpu | ||
numpy | ||
pytest | ||
onnx | ||
onnxruntime_gpu | ||
transformers | ||
huggingface_hub[cli] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.