Update README.md
Browse files
README.md
CHANGED
|
@@ -31,49 +31,10 @@ That still wasn't the full picture. A later three-way comparison — real ONNX o
|
|
| 31 |
|
| 32 |
A further architectural bug was identified (blocks 5, 8, and 18 also use asymmetric padding, the same class of issue as the original stem bug) but attempting to fix it caused an unexplained regression, so it was left unfixed. Whether this is the source of the remaining L2 gap is an open question — full details in [`legacy/README.md`](https://github.com/bghani/perchv2-pytorch/blob/main/legacy/README.md).
|
| 33 |
|
| 34 |
-
**If you need accurate, trainable
|
| 35 |
|
| 36 |
-
## Usage (legacy — see the note above)
|
| 37 |
-
|
| 38 |
-
`legacy` is not part of the installed `perchv2_pytorch` package — clone the [main repo](https://github.com/bghani/perchv2-pytorch) and add its root to `sys.path`:
|
| 39 |
-
|
| 40 |
-
```python
|
| 41 |
-
import sys
|
| 42 |
-
sys.path.insert(0, "/path/to/perchv2-pytorch")
|
| 43 |
-
|
| 44 |
-
import torch
|
| 45 |
-
from huggingface_hub import hf_hub_download
|
| 46 |
-
from legacy import PerchFrontend, Perch2Classifier, Perch2Embedder
|
| 47 |
-
|
| 48 |
-
weights_path = hf_hub_download(repo_id="bghani/perch2-pytorch-weights", filename="perch_v2_backbone_timm.pt")
|
| 49 |
-
|
| 50 |
-
# 1. Frozen features
|
| 51 |
-
embedder = Perch2Embedder(weights_path=weights_path)
|
| 52 |
-
embedder.eval()
|
| 53 |
-
waveform = torch.zeros(4, 160_000) # 5s clips @ 32kHz, batch of 4
|
| 54 |
-
with torch.no_grad():
|
| 55 |
-
embeddings = embedder(waveform) # (4, 1536)
|
| 56 |
-
|
| 57 |
-
# 2. Linear probing
|
| 58 |
-
mel = PerchFrontend()
|
| 59 |
-
model = Perch2Classifier(num_classes=42, mel=mel, weights_path=weights_path, mode="linear_probe")
|
| 60 |
-
|
| 61 |
-
# 3. Full fine-tuning
|
| 62 |
-
model = Perch2Classifier(num_classes=42, mel=mel, weights_path=weights_path, mode="finetune")
|
| 63 |
-
```
|
| 64 |
|
| 65 |
## License
|
| 66 |
|
| 67 |
Apache 2.0, inherited from the original Perch v2 release. See [NOTICE](https://github.com/bghani/perchv2-pytorch/blob/main/NOTICE) in the main repo for the full derivative-work attribution.
|
| 68 |
|
| 69 |
-
## Citation
|
| 70 |
-
|
| 71 |
-
If you use this in published work, please cite the original Perch v2 paper:
|
| 72 |
-
```
|
| 73 |
-
@article{van2025perch,
|
| 74 |
-
title={Perch 2.0: The bittern lesson for bioacoustics},
|
| 75 |
-
author={van Merri{"e}nboer, Bart and Dumoulin, Vincent and Hamer, Jenny and Harrell, Lauren and Burns, Andrea and Denton, Tom},
|
| 76 |
-
journal={arXiv preprint arXiv:2508.04665},
|
| 77 |
-
year={2025}
|
| 78 |
-
}
|
| 79 |
-
```
|
|
|
|
| 31 |
|
| 32 |
A further architectural bug was identified (blocks 5, 8, and 18 also use asymmetric padding, the same class of issue as the original stem bug) but attempting to fix it caused an unexplained regression, so it was left unfixed. Whether this is the source of the remaining L2 gap is an open question — full details in [`legacy/README.md`](https://github.com/bghani/perchv2-pytorch/blob/main/legacy/README.md).
|
| 33 |
|
| 34 |
+
**If you need accurate, trainable Perchv2 backbone, use the ONNX-converted backbone in the [main repo](https://github.com/bghani/perchv2-pytorch) instead — not these weights.**
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
## License
|
| 38 |
|
| 39 |
Apache 2.0, inherited from the original Perch v2 release. See [NOTICE](https://github.com/bghani/perchv2-pytorch/blob/main/NOTICE) in the main repo for the full derivative-work attribution.
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|