anton-l HF staff commited on
Commit
feb593a
1 Parent(s): fc40331

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -34,17 +34,18 @@ The model is fine-tuned on the [VoxCeleb1 dataset](https://www.robots.ox.ac.uk/~
34
  # Usage
35
  ## Speaker Verification
36
  ```python
37
- from transformers import Wav2Vec2FeatureExtractor, UniSpeechSatForXVector
38
  from datasets import load_dataset
39
  import torch
40
 
41
  dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
42
 
43
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
44
- model = UniSpeechSatForXVector.from_pretrained('microsoft/wavlm-base-plus-sv')
45
 
46
  # audio files are decoded on the fly
47
- inputs = feature_extractor(dataset[:2]["audio"]["array"], return_tensors="pt")
 
48
  embeddings = model(**inputs).embeddings
49
  embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()
50
 
 
34
  # Usage
35
  ## Speaker Verification
36
  ```python
37
+ from transformers import Wav2Vec2FeatureExtractor, WavLMForXVector
38
  from datasets import load_dataset
39
  import torch
40
 
41
  dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
42
 
43
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained('microsoft/wavlm-base-plus-sv')
44
+ model = WavLMForXVector.from_pretrained('microsoft/wavlm-base-plus-sv')
45
 
46
  # audio files are decoded on the fly
47
+ audio = [x["array"] for x in dataset[:2]["audio"]]
48
+ inputs = feature_extractor(audio, padding=True, return_tensors="pt")
49
  embeddings = model(**inputs).embeddings
50
  embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()
51