Jenthe commited on
Commit
e16bd36
·
1 Parent(s): 775dc8b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -2
README.md CHANGED
@@ -12,6 +12,31 @@ ECAPA2 is a hybrid neural network architecture and training strategy for speaker
12
 
13
  ## Usage Guide
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  ### Speaker Embedding Extraction
16
 
17
  Extracting speaker embeddings is easy and only requires a few lines of code:
@@ -20,8 +45,7 @@ import torch
20
  import torchaudio
21
 
22
  audio = torchaudio.load('sample.wav')
23
- ecapa2_model = torch.load('model.pt')
24
- embedding = ecapa2_model.extract_embedding(audio)
25
  ```
26
 
27
  ### Hierarchical Feature Extraction
 
12
 
13
  ## Usage Guide
14
 
15
+ ### Download model
16
+
17
+ You need to install the huggingface_hub package to download the ECAPA2 model:
18
+
19
+ ```
20
+ pip install --upgrade huggingface_hub
21
+ ```
22
+
23
+ Or with Conda:
24
+
25
+ ```
26
+ conda install -c conda-forge huggingface_hub
27
+ ```
28
+
29
+ Now you can download the model by executing the following code:
30
+
31
+ ```
32
+ from huggingface_hub import hf_hub_download
33
+
34
+ model_file = hf_hub_download(repo_id=Jenthe/ECAPA2, filename='model.pt')
35
+ model = torch.jit.load(model_file, map_location='cpu')
36
+ ```
37
+
38
+ Subsequent calls will load the previously downloaded model automatically.
39
+
40
  ### Speaker Embedding Extraction
41
 
42
  Extracting speaker embeddings is easy and only requires a few lines of code:
 
45
  import torchaudio
46
 
47
  audio = torchaudio.load('sample.wav')
48
+ embedding = model.extract_embedding(audio)
 
49
  ```
50
 
51
  ### Hierarchical Feature Extraction