postpop commited on
Commit
e9d3855
·
verified ·
1 Parent(s): ff83693

Document direct Hugging Face loading

Browse files
Files changed (1) hide show
  1. README.md +16 -0
README.md CHANGED
@@ -35,6 +35,22 @@ print(model.labels[index])
35
  This call downloads `perch_v2_torch.pt` from this Hugging Face repository and
36
  caches it locally.
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  Inputs are mono, 32 kHz waveforms with shape `(time,)` or `(batch, time)`.
39
  Audio longer than five seconds is processed in overlapping windows and pooled.
40
 
 
35
  This call downloads `perch_v2_torch.pt` from this Hugging Face repository and
36
  caches it locally.
37
 
38
+ ### With `huggingface_hub`
39
+
40
+ From the [GitHub repository](https://github.com/janclemenslab/perch2_torch)
41
+ checkout:
42
+
43
+ ```python
44
+ from huggingface_hub import hf_hub_download
45
+ from perch import load_model
46
+
47
+ checkpoint = hf_hub_download(
48
+ "DAS-DeepAudioSegmenter/perch2-torch",
49
+ "perch_v2_torch.pt",
50
+ )
51
+ model = load_model(checkpoint).eval()
52
+ ```
53
+
54
  Inputs are mono, 32 kHz waveforms with shape `(time,)` or `(batch, time)`.
55
  Audio longer than five seconds is processed in overlapping windows and pooled.
56