tiantiaf commited on
Commit
c30b825
·
verified ·
1 Parent(s): d46f9f9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -1
README.md CHANGED
@@ -31,4 +31,50 @@ The included English accents are:
31
 
32
 
33
  - Library: https://github.com/tiantiaf0627/vox-profile-release
34
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
 
33
  - Library: https://github.com/tiantiaf0627/vox-profile-release
34
+
35
+ # How to use this model
36
+
37
+ ## Download repo
38
+ ```
39
+ git clone [email protected]:tiantiaf0627/vox-profile-release.git
40
+ ```
41
+ ## Install the package
42
+ ```
43
+ conda create -n vox_profile python=3.8
44
+ cd vox-profile-release
45
+ pip install -e .
46
+ ```
47
+
48
+ ## Load the model
49
+ ```
50
+ # Load libraries
51
+ import torch
52
+ import torch.nn.functional as F
53
+ from src.model.accent.whisper_accent import WhisperWrapper
54
+
55
+ # Find device
56
+ device = torch.device("cuda") if torch.cuda.is_available() else "cpu"
57
+
58
+ # Load model from Huggingface
59
+ model = WhisperWrapper.from_pretrained("tiantiaf/whisper-large-narrow-accent").to(device)
60
+ model.eval()
61
+ ```
62
+
63
+ ## Prediction
64
+ ```
65
+ # Label List
66
+ english_accent_list = [
67
+ 'East Asia', 'English', 'Germanic', 'Irish',
68
+ 'North America', 'Northern Irish', 'Oceania',
69
+ 'Other', 'Romance', 'Scottish', 'Semitic', 'Slavic',
70
+ 'South African', 'Southeast Asia', 'South Asia', 'Welsh'
71
+ ]
72
+
73
+ # Load data, here just zeros as the example, audio data should be 16kHz mono channel
74
+ data = torch.zeros([1, 16000]).float().to(device)
75
+ logits, embeddings = model(data, return_feature=True)
76
+
77
+ # Probability and output
78
+ accent_prob = F.softmax(logits, dim=1)
79
+ print(english_accent_list[torch.argmax(accent_prob).detach().cpu().item()])
80
+ ```