khanhld commited on
Commit
552b1c8
1 Parent(s): 128a1fa

update readme

Browse files
Files changed (1) hide show
  1. README.md +7 -3
README.md CHANGED
@@ -74,10 +74,12 @@ We also provide code for Pre-training and Fine-tuning the Wav2vec2 model (not av
74
  |with LM| in progress | in progress |
75
 
76
  <a name = "example" ></a>
77
- ### Example Usage
78
  ```python
79
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
80
  import librosa
 
 
81
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
82
 
83
  processor = Wav2Vec2Processor.from_pretrained("khanhld/wav2vec2-base-vietnamese-160h")
@@ -94,10 +96,12 @@ def transcribe(wav):
94
 
95
  wav, _ = librosa.load('path/to/your/audio/file', sr = 16000)
96
  print(f"transcript: {transcribe(wav)}")
 
97
  ```
98
 
99
  <a name = "evaluation"></a>
100
- ### Evaluation
 
101
  ```python
102
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
103
  from datasets import load_dataset
@@ -115,7 +119,7 @@ model.to(device)
115
  model.eval()
116
 
117
  # Load dataset
118
- test_dataset = load_dataset("mozilla-foundation/common_voice_8_0", "vi", split="test")
119
  test_dataset = test_dataset.cast_column("audio", Audio(sampling_rate=16000))
120
  chars_to_ignore = r'[,?.!\-;:"“%\'�]' # ignore special characters
121
 
 
74
  |with LM| in progress | in progress |
75
 
76
  <a name = "example" ></a>
77
+ ### Example Usage [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1blz1KclnIfbOp8o2fW3WJgObOQ9SMGBo?usp=sharing)
78
  ```python
79
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
80
  import librosa
81
+ import torch
82
+
83
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
84
 
85
  processor = Wav2Vec2Processor.from_pretrained("khanhld/wav2vec2-base-vietnamese-160h")
 
96
 
97
  wav, _ = librosa.load('path/to/your/audio/file', sr = 16000)
98
  print(f"transcript: {transcribe(wav)}")
99
+
100
  ```
101
 
102
  <a name = "evaluation"></a>
103
+ ### Evaluation [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1XQCq4YGLnl23tcKmYeSwaksro4IgC_Yi?usp=sharing)
104
+
105
  ```python
106
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
107
  from datasets import load_dataset
 
119
  model.eval()
120
 
121
  # Load dataset
122
+ test_dataset = load_dataset("mozilla-foundation/common_voice_8_0", "vi", split="test", use_auth_token="your_huggingface_auth_token")
123
  test_dataset = test_dataset.cast_column("audio", Audio(sampling_rate=16000))
124
  chars_to_ignore = r'[,?.!\-;:"“%\'�]' # ignore special characters
125