open-perch 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. open_perch-0.1.0/.github/workflows/release.yml +102 -0
  2. open_perch-0.1.0/.github/workflows/test.yml +74 -0
  3. open_perch-0.1.0/.gitignore +14 -0
  4. open_perch-0.1.0/CHANGELOG.md +87 -0
  5. open_perch-0.1.0/CITATION.cff +20 -0
  6. open_perch-0.1.0/LICENSE +201 -0
  7. open_perch-0.1.0/NOTICE +34 -0
  8. open_perch-0.1.0/PKG-INFO +465 -0
  9. open_perch-0.1.0/README.md +420 -0
  10. open_perch-0.1.0/docs/assets/open-perch-banner.svg +1 -0
  11. open_perch-0.1.0/docs/assets/open-perch-social.png +0 -0
  12. open_perch-0.1.0/docs/getting-started.ipynb +234 -0
  13. open_perch-0.1.0/docs/reverse-engineering.md +429 -0
  14. open_perch-0.1.0/hubconf.py +37 -0
  15. open_perch-0.1.0/pyproject.toml +103 -0
  16. open_perch-0.1.0/scripts/compare_hoplite.py +283 -0
  17. open_perch-0.1.0/scripts/compare_outputs.py +373 -0
  18. open_perch-0.1.0/scripts/prepare_weights_release.py +71 -0
  19. open_perch-0.1.0/src/open_perch/__init__.py +91 -0
  20. open_perch-0.1.0/src/open_perch/__main__.py +5 -0
  21. open_perch-0.1.0/src/open_perch/audio.py +310 -0
  22. open_perch-0.1.0/src/open_perch/backbone.py +207 -0
  23. open_perch-0.1.0/src/open_perch/checkpoints.py +154 -0
  24. open_perch-0.1.0/src/open_perch/cli.py +68 -0
  25. open_perch-0.1.0/src/open_perch/config.py +261 -0
  26. open_perch-0.1.0/src/open_perch/convert.py +783 -0
  27. open_perch-0.1.0/src/open_perch/frontend.py +267 -0
  28. open_perch-0.1.0/src/open_perch/hub.py +97 -0
  29. open_perch-0.1.0/src/open_perch/model.py +287 -0
  30. open_perch-0.1.0/src/open_perch/py.typed +0 -0
  31. open_perch-0.1.0/src/open_perch/weights.py +168 -0
  32. open_perch-0.1.0/tests/smoke_test.py +82 -0
  33. open_perch-0.1.0/tests/test_audio.py +356 -0
  34. open_perch-0.1.0/tests/test_backbone_shapes.py +78 -0
  35. open_perch-0.1.0/tests/test_convert.py +143 -0
  36. open_perch-0.1.0/tests/test_frontend.py +150 -0
  37. open_perch-0.1.0/tests/test_model_smoke.py +257 -0
  38. open_perch-0.1.0/tests/test_weights.py +246 -0
  39. open_perch-0.1.0/uv.lock +2902 -0
@@ -0,0 +1,102 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ test:
10
+ # Lint, pytest and the wheel/sdist smoke test (the `package` job); every
11
+ # publish job below needs this whole workflow to pass.
12
+ name: Tests
13
+ uses: ./.github/workflows/test.yml
14
+
15
+ build:
16
+ name: Build distribution
17
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ channel: ${{ steps.meta.outputs.channel }}
20
+ version: ${{ steps.meta.outputs.version }}
21
+ steps:
22
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23
+ with:
24
+ fetch-depth: 0 # full history + branches for branch detection
25
+
26
+ # Only the stable channel (a v* tag on a commit in master) publishes to
27
+ # PyPI. Beta (in develop) and alpha (elsewhere) tags only produce a
28
+ # GitHub pre-release with the built distributions attached.
29
+ - name: Determine channel and version
30
+ id: meta
31
+ run: |
32
+ set -euo pipefail
33
+ BASE="${GITHUB_REF_NAME#v}" # v1.2.3 -> 1.2.3
34
+ git fetch --no-tags origin '+refs/heads/*:refs/remotes/origin/*'
35
+ BRANCHES="$(git branch -r --contains "${GITHUB_SHA}" | sed 's# *origin/##')"
36
+ echo "Branches containing ${GITHUB_SHA}:"; echo "${BRANCHES}"
37
+ if echo "${BRANCHES}" | grep -qx master; then
38
+ CHANNEL=stable; VERSION="${BASE}"
39
+ elif echo "${BRANCHES}" | grep -qx develop; then
40
+ CHANNEL=beta; VERSION="${BASE}b${GITHUB_RUN_NUMBER}"
41
+ else
42
+ CHANNEL=alpha; VERSION="${BASE}a${GITHUB_RUN_NUMBER}"
43
+ fi
44
+ echo "channel=${CHANNEL}" >> "${GITHUB_OUTPUT}"
45
+ echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
46
+ echo "Resolved channel=${CHANNEL} version=${VERSION}"
47
+
48
+ - name: Install uv
49
+ uses: astral-sh/setup-uv@v10.4.1 # immutable release: the tag cannot be moved
50
+ with:
51
+ enable-cache: auto # off for tag pushes and other sensitive events (setup-uv v10)
52
+
53
+ - name: Build
54
+ env:
55
+ # hatch-vcs (via setuptools-scm) honors the generic override; the per-dist
56
+ # variant is kept as harmless future-proofing in case dist_name passthrough lands.
57
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.meta.outputs.version }}
58
+ SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPEN_PERCH: ${{ steps.meta.outputs.version }}
59
+ run: uv build
60
+
61
+ - name: Check metadata
62
+ run: uvx twine check dist/*
63
+
64
+ - name: Upload artifacts
65
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
66
+ with:
67
+ name: dist
68
+ path: dist/
69
+
70
+ publish-pypi:
71
+ name: Publish to PyPI
72
+ needs: [build, test]
73
+ if: needs.build.outputs.channel == 'stable'
74
+ runs-on: ubuntu-latest
75
+ environment:
76
+ name: pypi
77
+ url: https://pypi.org/p/open-perch
78
+ permissions:
79
+ id-token: write
80
+ steps:
81
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
82
+ with:
83
+ name: dist
84
+ path: dist/
85
+ - uses: pypa/gh-action-pypi-publish@v1.14.3 # immutable release: the tag cannot be moved
86
+
87
+ github-release:
88
+ name: GitHub Release
89
+ needs: [build, test]
90
+ runs-on: ubuntu-latest
91
+ permissions:
92
+ contents: write
93
+ steps:
94
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
95
+ with:
96
+ name: dist
97
+ path: dist/
98
+ - uses: softprops/action-gh-release@88b783939ccdbabad21b9a37510aed7fad5f2e60 # v3.0.5
99
+ with:
100
+ files: dist/*
101
+ prerelease: ${{ needs.build.outputs.channel != 'stable' }}
102
+ generate_release_notes: true
@@ -0,0 +1,74 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: ["**"]
6
+ pull_request:
7
+ workflow_call: # reused by release.yml so nothing ships untested
8
+
9
+ jobs:
10
+ test:
11
+ name: pytest (Python ${{ matrix.python-version }})
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python-version: ["3.10", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v10.4.1 # immutable release: the tag cannot be moved
22
+ with:
23
+ enable-cache: auto # off for tag pushes and other sensitive events (setup-uv v10)
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install (CPU torch)
27
+ # uv.lock pins CUDA torch wheels; CI installs the CPU builds instead
28
+ # (torchvision too: timm needs it, and a PyPI build mismatches CPU torch).
29
+ run: |
30
+ uv venv
31
+ uv pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cpu
32
+ uv pip install -e ".[test]"
33
+
34
+ - name: Lint
35
+ run: uvx ruff check .
36
+
37
+ - name: Test
38
+ run: uv run --no-sync pytest -q
39
+
40
+ package:
41
+ name: Build and smoke-test distributions
42
+ runs-on: ubuntu-latest
43
+ env:
44
+ # PyPI torch is the multi-GB CUDA build. With --index and uv's default
45
+ # first-index strategy, every package the CPU index carries resolves
46
+ # from it: torch, torchaudio and torchvision (a timm dependency, which
47
+ # must match torch) come out as +cpu builds; timm etc. come from PyPI.
48
+ # Avoid --index-strategy unsafe-best-match: it can pick CUDA torch from
49
+ # PyPI whenever PyPI is a version ahead.
50
+ CPU_INDEX: https://download.pytorch.org/whl/cpu
51
+ steps:
52
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53
+ with:
54
+ fetch-depth: 0 # hatch-vcs derives the version from git history
55
+
56
+ - name: Install uv
57
+ uses: astral-sh/setup-uv@v10.4.1 # immutable release: the tag cannot be moved
58
+ with:
59
+ enable-cache: auto # off for tag pushes and other sensitive events (setup-uv v10)
60
+ python-version: "3.13"
61
+
62
+ - name: Build
63
+ run: uv build
64
+
65
+ - name: Check metadata
66
+ run: uvx twine check dist/*
67
+
68
+ # Install each distribution on its own, with only the runtime deps, and
69
+ # check that nothing crucial was left out of it (see tests/smoke_test.py).
70
+ - name: Smoke test (wheel)
71
+ run: uv run --isolated --no-project --index "$CPU_INDEX" --with dist/*.whl tests/smoke_test.py
72
+
73
+ - name: Smoke test (source distribution)
74
+ run: uv run --isolated --no-project --index "$CPU_INDEX" --with dist/*.tar.gz tests/smoke_test.py
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .venv/
7
+ build/
8
+ dist/
9
+ *.pt
10
+ *.safetensors
11
+ checkpoints/
12
+ saved_model/
13
+ .uv/
14
+ .ipynb_checkpoints/
@@ -0,0 +1,87 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-12-02
4
+
5
+ First PyPI release.
6
+
7
+ ### Added
8
+
9
+ - PyTorch ports of the Perch v1, Perch v2 and SurfPerch encoders and their
10
+ mel-spectrogram frontends (`PerchModel`), plus a SavedModel parity check
11
+ (`scripts/compare_outputs.py`).
12
+ - torchvision-style model builders `perch_v1`, `perch_v2` and `surfperch`
13
+ (`perch_v2(weights="DEFAULT")`) and
14
+ `load_perch(version=None, *, weights=None, progress=True,
15
+ map_location="cpu", strict=True)`.
16
+ - Pretrained weights: `weights="DEFAULT"` downloads the converted weights
17
+ from the `weights-v1` GitHub release into torch.hub's cache and checks them
18
+ against the SHA-256 prefix in the file name. `PerchWeights.V1` / `.V2` /
19
+ `.SURFPERCH` (or their names) select weights explicitly, and a path loads a
20
+ local `.pt` file from `open-perch convert`: `load_perch(weights="perch_v2.pt")`.
21
+ `load_perch` takes the version from the weights (`meta["version"]` for a
22
+ file) and raises if an explicit `version` disagrees; a bare state_dict
23
+ needs `version`. `scripts/prepare_weights_release.py` builds the release
24
+ assets.
25
+ - torch.hub entry points: the same builders, through `hubconf.py`:
26
+ `torch.hub.load("CMGeldenhuys/open-perch", "perch_v2", weights="DEFAULT")`.
27
+ - `open-perch convert` (also `python -m open_perch convert`): the converter
28
+ from the official TF SavedModels, formerly `scripts/convert_checkpoint.py`,
29
+ now ships in the package as `open_perch.convert`, so it works from a pip
30
+ install. `--source` is `kaggle` (default), `hf` (v2 only) or `local`;
31
+ `--strict-load` became `--check-load` and loads strictly. TensorFlow,
32
+ kagglehub and huggingface-hub are imported lazily and stay behind the
33
+ `[conversion]` extra; they are not runtime dependencies.
34
+ - `open_perch.audio`: the preprocessing Perch's Python wrapper
35
+ (perch-hoplite's `TaxonomyModelTF`) applies before the model:
36
+ `load_audio` (first channel, polyphase resample), `resample` (a pure-torch
37
+ port of `scipy.signal.resample_poly`, plus `"scipy"` and `"torchaudio"`
38
+ backends), `frame_audio` (centre-pad short clips, drop the trailing partial
39
+ window) and `normalize_audio` (per-window mean removal, peak 0.25).
40
+ - `PerchModel.preprocess` and `PerchModel.embed_audio` for Perch-equivalent
41
+ windows and embeddings from audio at any sample rate. `forward()` is
42
+ unchanged and still takes raw 32 kHz windows, like the SavedModel.
43
+ `embed_audio` gathers, normalises and embeds `batch_size` windows at a time
44
+ (default 64), so memory stays bounded with overlapping hops (10 min of
45
+ audio, 1 s hop, `batch_size=4`, v1 on CUDA: 1092 MB → 90 MB peak extra
46
+ memory).
47
+ - Typing and API docs: the package ships `py.typed`, the public API has
48
+ docstrings, `ResampleMethod` is exported, and `embed_audio` takes
49
+ `resample_method`, `hop_seconds` and `target_peak` as explicit keyword
50
+ parameters instead of `**kwargs`.
51
+ - `scripts/compare_hoplite.py`: end-to-end parity against perch-hoplite's TF
52
+ pipeline, starting from wav files.
53
+ - Extras: `[audio]` (soundfile), `[scipy]` (reference resampler),
54
+ `[conversion]` (TensorFlow, kagglehub, huggingface-hub; converter only).
55
+ - CI: ruff + pytest on Python 3.10 and 3.13; releases are gated on it.
56
+
57
+ ### Fixed
58
+
59
+ - The README, the getting-started notebook and `compare_outputs.py --audio`
60
+ no longer suggest the channel mean, torchaudio resampling, right-padding and
61
+ no normalisation. That recipe gives embeddings that differ from Perch's
62
+ (cosine as low as 0.24 on stereo input; see `docs/reverse-engineering.md`).
63
+ - Perch v1 uses a periodic Hann window (`FrontendConfig.window_periodic`),
64
+ which brings its frontend to float32-rounding parity with the SavedModel
65
+ (max abs 3.7e-4 → 4.1e-6).
66
+ - `embed` and `embed_audio` restore every submodule's train/eval flag
67
+ afterwards. They used to reset the whole model to one mode, so a BatchNorm
68
+ frozen with `.eval()` during fine-tuning came back in training mode.
69
+ - The polyphase resampler's filter cache is built outside
70
+ `torch.inference_mode()`. A first `resample()` call under inference mode
71
+ used to cache inference tensors, and later autograd calls on CPU failed
72
+ with "Inference tensors cannot be saved for backward".
73
+ - After one `forward(..., want_stages=True)` the backbone's stage hooks kept
74
+ capturing on every later forward, so training loops and `embed_audio`
75
+ accumulated seven feature maps (and their autograd graphs) per call. Stage
76
+ maps are now captured only during a `want_stages=True` forward.
77
+ - `resample` and `embed_audio` accept an empty batch, and `embed_audio`
78
+ casts float64 input to float32 when the model is on MPS (which has no
79
+ float64).
80
+ - `open-perch convert` pins the Kaggle model versions named in `NOTICE`
81
+ (v1 version 8, v2 version 2, SurfPerch version 1) instead of taking the
82
+ latest, and reports the real cause of a failed import or conversion
83
+ (`OPEN_PERCH_DEBUG=1` re-raises with the full traceback).
84
+ - `hubconf.py` restores `sys.path` after importing, and warns if a different
85
+ copy of `open_perch` is already imported.
86
+ - The package version comes from `v*` tags only, so the `weights-v1` release
87
+ tag is not read as version 1.
@@ -0,0 +1,20 @@
1
+ cff-version: 1.2.0
2
+ message: >-
3
+ If you use open-perch, please cite the original Perch / SurfPerch paper for
4
+ the model you use (listed in the README's Attribution section). If you would
5
+ also like to acknowledge this project, please cite it as below, with the
6
+ version you used.
7
+ title: "open-perch: a faithful PyTorch reimplementation of the Perch and SurfPerch bioacoustic encoders"
8
+ type: software
9
+ authors:
10
+ - family-names: Geldenhuys
11
+ given-names: Christiaan
12
+ license: Apache-2.0
13
+ repository-code: "https://github.com/CMGeldenhuys/open-perch"
14
+ version: 0.1.0
15
+ date-released: 2026-12-02
16
+ abstract: >-
17
+ A faithful PyTorch reimplementation of the encoders of Google's Perch v1,
18
+ Perch v2 and SurfPerch bioacoustic models, with converted
19
+ weights and Perch-equivalent audio preprocessing. Not affiliated with or
20
+ endorsed by Google.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 CM Geldenhuys
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,34 @@
1
+ open-perch
2
+ Copyright 2025 CM Geldenhuys
3
+
4
+ open-perch is an independent, unofficial PyTorch reimplementation of the
5
+ Perch v1, Perch v2 and SurfPerch bioacoustic models. It is not affiliated
6
+ with, endorsed by or supported by Google LLC or the authors of Perch and
7
+ SurfPerch. It is provided "AS IS", without warranties or conditions of any
8
+ kind; see sections 7 and 8 of the Apache License, Version 2.0 (LICENSE).
9
+
10
+ Converted model weights
11
+ -----------------------
12
+
13
+ The converted weights published as the open-perch "weights-v1" GitHub
14
+ release are derived from Google's TensorFlow SavedModels on Kaggle, each
15
+ licensed under the Apache License, Version 2.0:
16
+
17
+ * Perch v1: kaggle.com/models/google/bird-vocalization-classifier,
18
+ framework tensorFlow2, variation "bird-vocalization-classifier", version 8.
19
+ Copyright 2023 Google, LLC. Copyright 2025 Google, LLC.
20
+ * Perch v2: kaggle.com/models/google/bird-vocalization-classifier,
21
+ framework tensorFlow2, variation "perch_v2", version 2.
22
+ Copyright 2025 Google, LLC.
23
+ * SurfPerch: kaggle.com/models/google/surfperch, framework tensorFlow2,
24
+ variation "1", version 1.
25
+ Copyright 2024 Google, LLC.
26
+
27
+ Changes made: the encoder (EfficientNet backbone) variables of each
28
+ SavedModel were converted by open-perch's converter (`open-perch convert`)
29
+ to a PyTorch state_dict: tensors were renamed and their axes permuted to
30
+ PyTorch layouts; numerical values are unchanged. The classification heads
31
+ and label files are not included.
32
+
33
+ "Perch", "SurfPerch" and "Google" are used only to identify the origin of the
34
+ models; no trademark rights are granted or implied.