-
Notifications
You must be signed in to change notification settings - Fork 35
137 lines (128 loc) · 5.2 KB
/
unittests.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
name: Tests
on:
push:
branches:
- main
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TF_PYTHON_VERSION: "3.11"
jobs:
TFLite:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci-skip')"
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Run C++ Unit Tests
run: bazelisk test larq_compute_engine/tests:cc_tests --test_output=all
- name: Build TF Lite Static Library with CMake
run: |
mkdir build
cd build
cmake ..
make -j2
ARM:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci-skip')"
steps:
- uses: actions/checkout@v4
- name: Install qemu-user
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends qemu-user
- name: "TF Lite Arm32: Cross-compile and run unit tests in qemu"
run: bazelisk test larq_compute_engine/tests:arm32_tests --config=rpi3 --test_output=all --test_filter="-*BigTest*" --copt=-O1
- name: "TF Lite Aarch64: Cross-compile and run unit tests in qemu"
run: bazelisk test larq_compute_engine/tests:aarch64_tests --config=aarch64 --test_output=all --test_filter="-*BigTest*"
- name: "Benchmark utility: check it builds successfully"
run: bazelisk build //larq_compute_engine/tflite/benchmark:lce_benchmark_model --config=aarch64 --compilation_mode=fastbuild
MLIR:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci-skip')"
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
continue-on-error: true
with:
credentials_json: ${{ secrets.gcs_bazel_cache }}
- name: Configure Bazel
run: |
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
echo -e 'build --remote_cache=https://storage.googleapis.com/plumerai-bazel-cache/lce-ubuntu' >> .bazelrc.user
echo -e 'build --google_default_credentials' >> .bazelrc.user
fi
shell: bash
- name: Run Interpreter test
run: bazelisk test larq_compute_engine/tflite/tests:interpreter_test --test_output=all
- name: Run FileCheck tests
run: bazelisk test larq_compute_engine/mlir/tests:all --test_output=all
- name: Run End2End tests
run: bazelisk test larq_compute_engine/tests:end2end_test --test_output=all --test_env=TF_USE_LEGACY_KERAS=1
- name: Run Strip dequantize op tests
run: bazelisk test larq_compute_engine/tests:strip_lcedequantize_test --test_output=all --test_env=TF_USE_LEGACY_KERAS=1
ConverterPython:
runs-on: ubuntu-latest
strategy:
matrix:
tf-version: [2.5.3, 2.6.5, 2.7.4, 2.8.4, 2.9.3, 2.10.1, 2.11.0]
python-version: [3.9]
flatbuffers-version: [2.0]
protobuf-version: [3.19.6]
include:
- tf-version: 2.13.0
python-version: 3.11
flatbuffers-version: 23.1.21
protobuf-version: 4.23.4
- tf-version: 2.16.1
python-version: 3.11
flatbuffers-version: 24.3.25
protobuf-version: 4.25.3
if: "!contains(github.event.head_commit.message, 'ci-skip')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install TensorFlow
run: pip install tensorflow==${{matrix.tf-version}} --no-cache-dir
- name: Install legacy tf-keras
if: matrix.tf-version == '2.16.1'
run: pip install tf-keras==2.16.0
- name: Install flatbuffers
run: pip install flatbuffers==${{matrix.flatbuffers-version}} --no-cache-dir
- name: Install protobuf
run: pip install protobuf==${{matrix.protobuf-version}} --no-cache-dir
- name: Install other dependencies
run: pip install larq~=0.13.3 packaging tqdm --no-cache-dir
- name: Run Converter test
run: TF_USE_LEGACY_KERAS=1 PYTHONPATH=./ python larq_compute_engine/mlir/python/converter_test.py
Android_AAR:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci-skip')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/cache@v4
id: cache
with:
path: /tmp/lce_android
key: ${{ runner.os }}-${{ hashFiles('**/third_party/install_android.sh') }}
- name: Set Java version
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV
- name: Download and install Android NDK/SDK
if: steps.cache.outputs.cache-hit != 'true'
run: ./third_party/install_android.sh
- name: Configure Bazel
run: LCE_SET_ANDROID_WORKSPACE=1 ANDROID_SDK_HOME="/tmp/lce_android" ANDROID_API_LEVEL=30 ANDROID_NDK_HOME="/tmp/lce_android/ndk/25.2.9519653" ANDROID_NDK_API_LEVEL=30 ANDROID_BUILD_TOOLS_VERSION=31.0.0 ./configure.py
shell: bash
- name: Build LCE AAR
run: BUILDER=bazelisk ./larq_compute_engine/tflite/java/build_lce_aar.sh