-
Notifications
You must be signed in to change notification settings - Fork 11
144 lines (119 loc) · 4.1 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install lint dependencies
run: |
pip install wheel setuptools
pip install black==22.3.0 isort==5.10.1 flake8==4.0.1
- name: Lint the code
run: sh shell/lint.sh
- name: Install dependencies
run: |
pip install tensorflow==2.8.0 tensorflow-addons
pip install "protobuf<=3.20" --force-reinstall
- name: Build wheel
run: python setup.py bdist_wheel
- name: Upload Python wheel
uses: actions/upload-artifact@v2
with:
name: Python wheel
path: ${{github.workspace}}/dist/gradient_accumulator-*.whl
if-no-files-found: error
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
# max-parallel: 10
matrix:
os: [windows-2019, ubuntu-20.04, macos-11]
python-version: ["3.8", "3.9", "3.10"]
tf-version: [2.8, 2.12]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install wheel setuptools flake8 pytest-cov
- name: Install tensorflow-datasets
run: |
if [[ ${{ matrix.tf-version }} == 2.12 ]]; then
pip install "tensorflow-datasets<=4.9.2"
else
pip install tensorflow==${{ matrix.tf-version }} "tensorflow-datasets<=4.8.2"
pip install "protobuf<=3.20" --force-reinstall
fi
shell: bash
- name: Download artifact
uses: actions/download-artifact@master
with:
name: "Python wheel"
- name: Install wheel
run: pip install --find-links=. gradient_accumulator-*
shell: bash
- name: Debug pip deps
run: pip list
- name: Test library accessibility
run: python -c "from gradient_accumulator import GradientAccumulateModel, GradientAccumulateOptimizer"
- name: Run tests
run: |
pytest -v tests/test_expected_result.py
pytest -v tests/test_mixed_precision.py
pytest -v tests/test_optimizer_invariance.py
pytest -v tests/test_multitask.py
pytest -v tests/test_adaptive_gradient_clipping.py
pytest -v tests/test_batch_norm.py
pytest -v tests/test_bn_convnd.py
pytest -v tests/test_bn_pretrained_swap.py
pytest -v tests/test_mp_batch_norm.py
pytest -v tests/test_optimizer_distribute.py
pytest -v tests/test_model_distribute.py
tf-compability:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.6"]
tf-version: [2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.6.2]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install wheel setuptools flake8 pytest-cov
- name: Install tensorflow-datasets
run: |
pip install tensorflow==${{ matrix.tf-version }} "tensorflow-datasets<=4.8.2"
pip install "protobuf<=3.20" --force-reinstall
- name: Download artifact
uses: actions/download-artifact@master
with:
name: "Python wheel"
- name: Install wheel
run: pip install --find-links=. gradient_accumulator-*
shell: bash
- name: Debug pip deps
run: pip list
- name: Test library accessibility
run: python -c "from gradient_accumulator import GradientAccumulateModel, GradientAccumulateOptimizer"
- name: Run tests
run: pytest -v tests/test_model_expected_result.py