Fix flakes in masked lm testing by removing any indeterminism #888
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: Tests | |
on: | |
push: | |
pull_request: | |
release: | |
types: [created] | |
jobs: | |
build: | |
name: Test the code with tf.keras | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
python -m pip install --upgrade pip setuptools | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt --progress-bar off | |
pip install --no-deps -e "." --progress-bar off | |
- name: Test with pytest | |
run: | | |
pytest --cov=keras_nlp --cov-report xml:coverage.xml keras_nlp/ | |
- name: Run integration tests | |
run: | | |
python pip_build.py --install && cd integration_tests && pytest . | |
multibackend: | |
name: Test the code with Keras Core | |
strategy: | |
fail-fast: false | |
matrix: | |
backend: [tensorflow, jax, torch] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
python -m pip install --upgrade pip setuptools | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt --progress-bar off | |
pip install torch>=2.0.1+cpu --progress-bar off | |
pip install jax[cpu] --progress-bar off | |
pip install --no-deps -e "." --progress-bar off | |
- name: Test with pytest | |
env: | |
KERAS_BACKEND: ${{ matrix.backend }} | |
run: | | |
pytest keras_nlp/ | |
format: | |
name: Check the code format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
python -m pip install --upgrade pip setuptools | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt --progress-bar off | |
pip install --no-deps -e "." --progress-bar off | |
- name: Lint | |
run: bash shell/lint.sh |