fix: fix evaluation in the training pipeline #98
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
name: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
jobs: | |
lint-ruff: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Lint with ruff | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install | |
# stop the build if there are Python syntax errors or undefined names | |
poetry run ruff . | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
poetry run ruff . | |
check-black: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: check black | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --only dev | |
poetry run black --check . | |
env: | |
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }} | |
check-mypy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: check mypy | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --all-extras | |
poetry run mypy textbook | |
# run all tests | |
run-training-test: | |
needs: [check-black, lint-ruff] | |
runs-on: [self-hosted, x64, gpu, linux] | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Prepare environment | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -U poetry | |
poetry install | |
poetry run pip install torch | |
poetry run huggingface-cli login --token $HF_AUTH_TOKEN | |
- name: Test | |
id: test | |
run: | | |
poetry run pytest tests/training -m "not slow" | |
timeout-minutes: 30 | |
env: | |
HF_AUTH_TOKEN: ${{ secrets.HF_AUTH_TOKEN }} | |
run-dataset-gen-test: | |
needs: [check-black, lint-ruff] | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Prepare environment | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -U poetry | |
poetry install | |
poetry run pip install torch | |
- name: Test | |
id: test | |
run: | | |
poetry run pytest tests/dataset_gen -m "not slow and not openai" | |
timeout-minutes: 30 | |
run-evaluation-test: | |
needs: [check-black, lint-ruff] | |
runs-on: [self-hosted, x64, gpu, linux] | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Prepare environment | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -U poetry | |
poetry install | |
poetry run pip install torch | |
poetry run huggingface-cli login --token $HF_AUTH_TOKEN | |
- name: Test | |
id: test | |
run: | | |
poetry run pytest tests/eval | |
timeout-minutes: 10 | |
env: | |
HF_AUTH_TOKEN: ${{ secrets.HF_AUTH_TOKEN }} | |
# just for blocking the merge until all parallel core-test are successful | |
success-all-test: | |
needs: [check-mypy, run-training-test, run-dataset-gen-test, check-black, lint-ruff] | |
if: always() | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v2 | |
- name: Check Failure | |
if: env.WORKFLOW_CONCLUSION == 'failure' | |
run: exit 1 | |
- name: Success | |
if: ${{ success() }} | |
run: echo "All Done" |