feat: add mixed-precision and agc to gradaccum optimizer #313
Workflow file for this run
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: codecov | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
pip install wheel setuptools | |
pip install tensorflow==2.8.0 | |
pip install "protobuf<=3.20" --force-reinstall | |
- name: Build wheel | |
run: python setup.py bdist_wheel | |
- name: Upload Python wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Python wheel | |
path: ${{github.workspace}}/dist/gradient_accumulator-*.whl | |
if-no-files-found: error | |
codecov: | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
pip install wheel setuptools flake8 pytest-cov | |
pip install tensorflow==2.8.0 "tensorflow-datasets<=4.8.2" | |
pip install "protobuf<=3.20" --force-reinstall | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: "Python wheel" | |
- name: Install wheel | |
run: pip install --find-links=${{github.workspace}} gradient_accumulator | |
- name: Test library accessibility | |
run: python -c "from gradient_accumulator import GradientAccumulateModel, GradientAccumulateOptimizer" | |
- name: Run tests and collect coverage | |
run: | | |
pytest --cov=gradient_accumulator tests/test_optimizer_wrapper.py \ | |
--cov=gradient_accumulator tests/test_mixed_precision.py \ | |
--cov=gradient_accumulator tests/test_adaptive_gradient_clipping.py \ | |
--cov=gradient_accumulator tests/test_sparse_optimizer.py \ | |
--cov=gradient_accumulator tests/test_expected_result.py \ | |
--cov=gradient_accumulator tests/test_mp_batch_norm.py \ | |
--cov=gradient_accumulator tests/test_bn_convnd.py \ | |
--cov=gradient_accumulator tests/test_bn_pretrained_swap.py \ | |
--cov=gradient_accumulator tests/test_model_distribute.py \ | |
--cov=gradient_accumulator tests/test_optimizer.py | |
- name: Lint with flake8 | |
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 |