Birdnet 3#47
Open
Josef-Haupt wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds BirdNET acoustic model v3.0 support to the codebase, introducing PyTorch (TorchScript) and ONNX backends alongside the existing TF/PB model infrastructure.
Changes:
- Introduce new acoustic v3.0 model implementation and download/label generation logic.
- Add Torch and ONNX runtime backends, loader support, and optional dependency extras.
- Expand the test suite to cover v3.0 loading, custom loading, and PT-vs-ONNX output comparisons.
Reviewed changes
Copilot reviewed 16 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/birdnet/utils/local_data.py | Adds .pt and .onnx model path resolution for new backends. |
| src/birdnet/model_loader.pyi | Updates typing overloads to expose v3.0 acoustic model backends (pt, onnx). |
| src/birdnet/model_loader.py | Implements v3.0 acoustic loading + optional runtime availability checks and clearer unsupported-backend errors. |
| src/birdnet/globals.py | Adds acoustic v3.0 version constant and expands backend literals to include pt/onnx. |
| src/birdnet/core/backends.py | Introduces TorchBackend and OnnxBackend, plus runtime detection utilities and model loaders. |
| src/birdnet/acoustic/models/v3_0/model.py | Adds v3.0 acoustic model API + label/taxonomy download and per-language label generation. |
| src/birdnet/acoustic/models/v3_0/pt.py | Adds TorchScript downloader + backend adapter for v3.0 acoustic model. |
| src/birdnet/acoustic/models/v3_0/onnx.py | Adds ONNX downloader + backend adapter for v3.0 acoustic model. |
| src/birdnet/acoustic/models/v3_0/init.py | Declares the v3.0 acoustic models package. |
| src/birdnet_tests/model_loader_py/acoustic/test_acoustic_load_v3_0.py | Tests v3.0 loader behavior, runtime gating, and backend selection. |
| src/birdnet_tests/model_loader_py/acoustic/test_acoustic_load_custom_v3_0.py | Tests custom model loading and suffix validation for v3.0. |
| src/birdnet_tests/helper.py | Adds skip helpers for torch/onnxruntime and improves array closeness assertions. |
| src/birdnet_tests/acoustic_models/v3_0/test_model_v3_0.py | Tests language-file generation from taxonomy/labels inputs. |
| src/birdnet_tests/acoustic_models/v3_0/model_py/test_predict/test_acoustic_predict_model_v3_0.py | Adds v3.0 prediction shape/segment-size tests and PT-vs-ONNX closeness checks. |
| src/birdnet_tests/acoustic_models/v3_0/model_py/test_encode/test_acoustic_encode_model_v3_0.py | Adds v3.0 encoding shape/segment-size tests and PT-vs-ONNX closeness checks. |
| src/birdnet_tests/acoustic_models/v2_4/** | Adds additional v2.4 session/validation/download-related tests. |
| pyproject.toml | Adds optional extras for pt/onnx and includes them in tox deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VALID_ACOUSTIC_MODEL_VERSIONS = [ | ||
| ACOUSTIC_MODEL_VERSION_V2_4, | ||
| ACOUSTIC_MODEL_VERSION_V3_0, | ||
| ACOUSTIC_MODEL_VERSION_V2, |
| ) | ||
|
|
||
| monkeypatch.setattr(model_module, "_LABELS_RAW_PATH", labels_raw) | ||
| monkeypatch.setattr(model_module, "_TAXONOMY_PATH", taxonomy) |
| VALID_ACOUSTIC_MODEL_VERSIONS = [ | ||
| ACOUSTIC_MODEL_VERSION_V2_4, | ||
| ACOUSTIC_MODEL_VERSION_V3_0, | ||
| ACOUSTIC_MODEL_VERSION_V2, |
Comment on lines
+160
to
+162
| localized_name = en_us_name | ||
| lines.append(f"{sci_name}_{localized_name}") | ||
| lang_file.write_text("\n".join(lines), encoding="utf-8") |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.