Skip to content

Commit

Permalink
test (gha/ex/llm): Added new workflow to testing LLM example
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfraser committed Aug 23, 2024
1 parent f8ad2ab commit b7c4808
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/examples_llm_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Examples LLM Pytest

on:
push:
branches: [ master, dev ]
pull_request:
types:
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false


matrix:
python_version: ['3.8', '3.9']
pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0']
platform: ['windows-latest', 'ubuntu-latest', 'macos-latest']
jit_status: ['jit_disabled', 'jit_enabled']


exclude:
- pytorch_version: '1.9.1'
platform: 'macos-latest'

- pytorch_version: '1.9.1'
jit_status: 'jit_enabled'



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install Nox dependencies
shell: bash
run: pip install -r requirements/requirements-nox.txt

- name: Install update
shell: bash
run: sudo apt-get update
if: startsWith(runner.os, 'Linux') == true

- name: Install libsndfile and libgomp1 on Ubuntu
shell: bash
run: sudo apt-get install -y libsndfile-dev libgomp1
if: startsWith(runner.os, 'Linux') == true

- name: Install libomp on macOS
shell: bash
run: brew install libomp
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for brevitas_examples pytest
shell: bash
run: nox -v -s tests_brevitas_examples_llm-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)
26 changes: 26 additions & 0 deletions .github/workflows/gen_github_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
BASE_YML_REDUCED_TEMPLATE = 'base_reduced.yml.template'
PYTEST_YML = 'pytest.yml'
EXAMPLES_PYTEST_YML = 'examples_pytest.yml'
EXAMPLES_LLM_PYTEST_YML = 'examples_llm_pytest.yml'
DEVELOP_INSTALL_YML = 'develop_install.yml'
FINN_INTEGRATION_YML = 'finn_integration.yml'
ORT_INTEGRATION_YML = 'ort_integration.yml'
Expand Down Expand Up @@ -80,6 +81,13 @@
'nox -v -s tests_brevitas_examples_cpu-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)'
)]),]

EXAMPLES_LLM_PYTEST_STEP_LIST = [
od([('name', 'Run Nox session for brevitas_examples pytest'), ('shell', 'bash'),
(
'run',
'nox -v -s tests_brevitas_examples_llm-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)'
)]),]

FINN_INTEGRATION_STEP_LIST = [
od([('name', 'Install protobuf on Ubuntu'), ('shell', 'bash'),
('run', 'sudo apt-get install protobuf-compiler libprotoc-dev'),
Expand Down Expand Up @@ -167,6 +175,23 @@ def gen_examples_pytest_yml():
pytest.gen_yaml(BASE_YML_REDUCED_TEMPLATE, 'reduced_' + EXAMPLES_PYTEST_YML)


def gen_examples_llm_pytest_yml():
pytest = Action(
'Examples LLM Pytest',
EXCLUDE_LIST + JIT_EXCLUDE_LIST,
combine_od_list([MATRIX, PYTEST_MATRIX_EXTRA]),
EXAMPLES_LLM_PYTEST_STEP_LIST,
STRATEGY)
pytest.gen_yaml(BASE_YML_TEMPLATE, EXAMPLES_LLM_PYTEST_YML)
pytest = Action(
'Examples LLM Pytest',
EXCLUDE_LIST,
combine_od_list([MATRIX_REDUCED, PYTEST_MATRIX_EXTRA_REDUCED]),
EXAMPLES_LLM_PYTEST_STEP_LIST,
STRATEGY)
pytest.gen_yaml(BASE_YML_REDUCED_TEMPLATE, 'reduced_' + EXAMPLES_LLM_PYTEST_YML)


def gen_test_develop_install_yml():
test_develop_install = Action(
'Test develop install', EXCLUDE_LIST, MATRIX, TEST_INSTALL_DEV_STEP_LIST, STRATEGY)
Expand Down Expand Up @@ -243,6 +268,7 @@ def gen_test_brevitas_end_to_end():
if __name__ == '__main__':
gen_pytest_yml()
gen_examples_pytest_yml()
gen_examples_llm_pytest_yml()
gen_test_develop_install_yml()
gen_test_brevitas_finn_integration()
gen_test_brevitas_ort_integration()
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/reduced_examples_llm_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Examples LLM Pytest

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review


jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false


matrix:
python_version: ['3.8']
pytorch_version: ['1.9.1', '1.13.0', '2.1.0']
platform: ['ubuntu-latest']
jit_status: ['jit_disabled']


exclude:
- pytorch_version: '1.9.1'
platform: 'macos-latest'



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install Nox dependencies
shell: bash
run: pip install -r requirements/requirements-nox.txt

- name: Install update
shell: bash
run: sudo apt-get update
if: startsWith(runner.os, 'Linux') == true

- name: Install libsndfile and libgomp1 on Ubuntu
shell: bash
run: sudo apt-get install -y libsndfile-dev libgomp1
if: startsWith(runner.os, 'Linux') == true

- name: Install libomp on macOS
shell: bash
run: brew install libomp
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for brevitas_examples pytest
shell: bash
run: nox -v -s tests_brevitas_examples_llm-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)

0 comments on commit b7c4808

Please sign in to comment.