tiantiaf commited on
Commit
5cf5e1f
·
verified ·
1 Parent(s): 97c835e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -1
README.md CHANGED
@@ -19,4 +19,50 @@ This model includes the implementation of broader accent classification describe
19
  The included English accents are: ['British Isles', 'North America', 'Other']
20
 
21
  - Library: https://github.com/tiantiaf0627/vox-profile-release
22
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  The included English accents are: ['British Isles', 'North America', 'Other']
20
 
21
  - Library: https://github.com/tiantiaf0627/vox-profile-release
22
+
23
+
24
+ # How to use this model
25
+
26
+ ## Download repo
27
+ ```
28
+ git clone [email protected]:tiantiaf0627/vox-profile-release.git
29
+ ```
30
+ ## Install the package
31
+ ```
32
+ conda create -n vox_profile python=3.8
33
+ cd vox-profile-release
34
+ pip install -e .
35
+ ```
36
+
37
+ ## Load the model
38
+ ```
39
+ # Load libraries
40
+ import torch
41
+ import torch.nn.functional as F
42
+ from src.model.accent.wavlm_accent import WavLMWrapper
43
+
44
+ # Find device
45
+ device = torch.device("cuda") if torch.cuda.is_available() else "cpu"
46
+
47
+ # Load model from Huggingface
48
+ model = WavLMWrapper.from_pretrained("tiantiaf/wavlm-large-broader-accent").to(device)
49
+ model.eval()
50
+ ```
51
+
52
+ ## Prediction
53
+ ```
54
+ # Label List
55
+ english_accent_list = [
56
+ 'British Isles', 'North America', 'Other'
57
+ ]
58
+
59
+ # Load data, here just zeros as the example, audio data should be 16kHz mono channel
60
+ data = torch.zeros([1, 16000]).float().to(device)
61
+ logits, embeddings = model(data, return_feature=True)
62
+
63
+ # Probability and output
64
+ accent_prob = F.softmax(logits, dim=1)
65
+ print(english_accent_list[torch.argmax(accent_prob).detach().cpu().item()])
66
+ ```
67
+
68
+ ## If you have any questions, please contact: Tiantian Feng ([email protected])