Skip to content

Commit a8960be

Browse files
committed
update litert handling
1 parent 5783569 commit a8960be

3 files changed

Lines changed: 80 additions & 42 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: |
4949
pytest -m "load_model" -n auto
5050
51-
build-and-test-no-litert:
51+
build-and-test-standard:
5252
needs: build-and-dl-models
5353
runs-on: ${{ matrix.os }}
5454

@@ -63,7 +63,7 @@ jobs:
6363
macos-15-intel,
6464
windows-2025,
6565
]
66-
python-version: ["3.11", "3.12"]
66+
python-version: ["3.11", "3.12", "3.13"]
6767

6868
steps:
6969
- uses: actions/checkout@v4
@@ -92,27 +92,31 @@ jobs:
9292

9393
- name: Run tests
9494
run: |
95-
pytest -m "not load_model and not repro and (not litert and not gpu)" -n auto
95+
pytest -m "not repro and load_model" -n auto --max-worker-restart=0
96+
pytest -m "not repro and not load_model and (not litert and not gpu)" -n auto --max-worker-restart=0
97+
pytest -m "not repro and not load_model and litert" -n auto --max-worker-restart=0
9698
9799
- name: Test build
98100
run: |
99101
python -m build -o dist/
100102
python -m twine check dist/*
101103
102-
build-and-test-with-litert:
104+
build-and-test-repro:
103105
needs: build-and-dl-models
104106
runs-on: ${{ matrix.os }}
105107

106108
strategy:
107109
matrix:
108-
os: [
110+
os:
111+
[
109112
ubuntu-slim,
110113
ubuntu-24.04,
111114
ubuntu-24.04-arm,
112115
macos-15,
113-
# intel mac and windows not supported for litert
116+
macos-15-intel,
117+
windows-2025,
114118
]
115-
python-version: ["3.11", "3.12"]
119+
python-version: ["3.12"]
116120

117121
steps:
118122
- uses: actions/checkout@v4
@@ -128,16 +132,13 @@ jobs:
128132
- name: Install dependencies
129133
run: |
130134
python -m pip install uv build --upgrade
131-
python -m uv pip install --system .[tests,litert]
132-
133-
# - name: Run linters
134-
# run: |
135-
# ruff check src/mel_cepstral_distance
136-
# ruff check src/mel_cepstral_distance_tests
137-
138-
# - name: Type checking
139-
# run: mypy
135+
python -m uv pip install --system .[tests,repro]
140136
141137
- name: Run tests
142138
run: |
143-
pytest -m "not load_model and not repro and litert" -n auto
139+
pytest -m "load_model" -n auto --max-worker-restart=0
140+
# run normal tests including repro tests
141+
pytest -m "not load_model and (not litert and not gpu)" -n auto --max-worker-restart=0
142+
# run litert tests including repro tests
143+
pytest -m "not load_model and litert" -n auto --max-worker-restart=0
144+
# gpu tests are not supported to be run with repro environment

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Changed
1919

20+
- Removed `litert` install option, now litert is always installed if possible
2021
- Improved prediction speed, esp. for half-precision models (+10 seg/s)
2122
- Lowered dependencies
2223
- Update `ai-edge-litert` to version 2.0.3 on `repro`
@@ -27,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2728

2829
- Added `repro` option to be able to get reproducible results
2930
- Added support for Python 3.13
31+
- Added CI on GitHub Actions for testing on multiple OS and Python versions
3032

3133
### Removed
3234

pyproject.toml

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,69 @@ dependencies = [
4242
"psutil >= 5.9.0", # 2021/12/29
4343
"pyarrow >= 7.0.0", # 2022/02/03
4444
"tensorflow >= 2.8.0", # 2022/02/02
45+
"ai-edge-litert >= 2.0.2 ; python_version < '3.13' and (sys_platform == 'linux' or sys_platform == 'darwin')", # 2025/09/17
4546
]
4647

4748
[project.optional-dependencies]
48-
litert = [
49-
"ai-edge-litert >= 2.0.2" # 2025/09/17
50-
]
5149
and-cuda = [
5250
"tensorflow[and-cuda] >= 2.8.0" # 2022/02/02
5351
]
5452
repro = [
55-
# "resampy == 0.4.3",
53+
# Reproducible results only with Python 3.12 and on CPU
54+
# Direct dependencies
5655
"soundfile == 0.12.1",
5756
"scipy == 1.16.3",
5857
"ordered-set == 4.1.0",
5958
"tqdm == 4.67.1",
60-
"numpy == 2.0.2",
61-
# "numba == 0.62.1",
59+
"numpy == 2.1.0",
6260
"pandas == 2.3.3",
6361
"psutil == 7.1.3",
6462
"pyarrow == 22.0.0",
6563
"tensorflow == 2.20.0",
66-
"ai-edge-litert == 2.0.3; sys_platform == 'linux' or sys_platform == 'darwin'",
64+
"ai-edge-litert == 2.0.3 ; sys_platform == 'linux' or sys_platform == 'darwin'",
65+
# Indirect dependencies
66+
"absl-py == 2.3.1",
67+
"astunparse == 1.6.3",
68+
"backports.strenum == 1.2.8",
69+
"certifi == 2025.11.12",
70+
"cffi == 2.0.0",
71+
"charset-normalizer == 3.4.4",
72+
"flatbuffers == 25.9.23",
73+
"gast == 0.6.0",
74+
"google-pasta == 0.2.0",
75+
"grpcio == 1.76.0",
76+
"h5py == 3.15.1",
77+
"idna == 3.11",
78+
"keras == 3.12.0",
79+
"libclang == 18.1.1",
80+
"Markdown == 3.10",
81+
"markdown-it-py == 4.0.0",
82+
"MarkupSafe == 3.0.3",
83+
"mdurl == 0.1.2",
84+
"ml_dtypes == 0.5.4",
85+
"namex == 0.1.0",
86+
"opt_einsum == 3.4.0",
87+
"optree == 0.18.0",
88+
"packaging == 25.0",
89+
"pillow == 12.0.0",
90+
"protobuf == 6.33.1",
91+
"pycparser == 2.23",
92+
"Pygments == 2.19.2",
93+
"python-dateutil == 2.9.0.post0",
94+
"pytz == 2025.2",
95+
"requests == 2.32.5",
96+
"rich == 14.2.0",
97+
"setuptools == 80.9.0",
98+
"six == 1.17.0",
99+
"tensorboard == 2.20.0",
100+
"tensorboard-data-server == 0.7.2",
101+
"termcolor == 3.2.0",
102+
"typing_extensions == 4.15.0",
103+
"tzdata == 2025.2",
104+
"urllib3 == 2.5.0",
105+
"Werkzeug == 3.1.3",
106+
"wheel == 0.45.1",
107+
"wrapt == 2.0.1",
67108
]
68109
tests = [
69110
"uv >= 0.9.7",
@@ -145,7 +186,7 @@ known-first-party = ["birdnet*"]
145186
[tool.tox]
146187
legacy_tox_ini = """
147188
[tox]
148-
envlist = py{311,312}, py{312}-repro, py{313}
189+
envlist = py{311,312,313}, py{312}-repro
149190
isolated_build = True
150191
151192
[testenv]
@@ -156,31 +197,25 @@ allowlist_externals = uv
156197
install_command = uv pip install {opts} {packages}
157198
158199
deps =
159-
.[tests,litert,and-cuda]
200+
.[tests,and-cuda]
160201
commands =
161202
# ruff check src/birdnet
162203
# ruff check src/birdnet_tests
163-
pytest -m "load_model" -n auto
164-
pytest -m "not load_model and not repro and (not litert and not gpu)" -n auto
165-
pytest -m "not load_model and not repro and litert" -n auto
166-
pytest -m "not load_model and not repro and gpu" -n 1
204+
pytest -m "not repro and load_model" -n auto --max-worker-restart=0
205+
pytest -m "not repro and not load_model and (not litert and not gpu)" -n auto --max-worker-restart=0
206+
pytest -m "not repro and not load_model and litert" -n auto --max-worker-restart=0
207+
pytest -m "not repro and not load_model and gpu" -n 1 --max-worker-restart=0
167208
168209
[testenv:py312-repro]
169210
deps =
170211
.[tests,repro]
171212
commands =
172-
pytest -m "load_model" -n auto
173-
pytest -m "not load_model and repro and (not litert and not gpu)" -n auto
174-
pytest -m "not load_model and repro and litert" -n auto
175-
pytest -m "not load_model and repro and gpu" -n 1
176-
177-
[testenv:py313]
178-
deps =
179-
.[tests,and-cuda]
180-
commands =
181-
pytest -m "load_model" -n auto
182-
pytest -m "not load_model and not repro and (not litert and not gpu)" -n auto
183-
pytest -m "not load_model and not repro and gpu" -n 1
213+
pytest -m "load_model" -n auto --max-worker-restart=0
214+
# run normal tests including repro tests
215+
pytest -m "not load_model and (not litert and not gpu)" -n auto --max-worker-restart=0
216+
# run litert tests including repro tests
217+
pytest -m "not load_model and litert" -n auto --max-worker-restart=0
218+
# gpu tests are not supported to be run with repro environment
184219
"""
185220

186221
[build-system]

0 commit comments

Comments
 (0)