patrickvonplaten commited on
Commit
1f15f82
1 Parent(s): 3bad500

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -8
README.md CHANGED
@@ -57,19 +57,12 @@ To transcribe audio files the model can be used as a standalone acoustic model a
57
  # load model and processor
58
  processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-robust-ft-swbd-300h")
59
  model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-robust-ft-swbd-300h")
60
-
61
- # define function to read in sound file
62
- def map_to_array(batch):
63
- speech, _ = sf.read(batch["file"])
64
- batch["speech"] = speech
65
- return batch
66
 
67
  # load dummy dataset and read soundfiles
68
  ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
69
- ds = ds.map(map_to_array)
70
 
71
  # tokenize
72
- input_values = processor(ds["speech"][:2], return_tensors="pt", padding="longest").input_values # Batch size 1
73
 
74
  # retrieve logits
75
  logits = model(input_values).logits
 
57
  # load model and processor
58
  processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-robust-ft-swbd-300h")
59
  model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-robust-ft-swbd-300h")
 
 
 
 
 
 
60
 
61
  # load dummy dataset and read soundfiles
62
  ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
 
63
 
64
  # tokenize
65
+ input_values = processor(ds[0]["audio"]["array"], return_tensors="pt", padding="longest").input_values # Batch size 1
66
 
67
  # retrieve logits
68
  logits = model(input_values).logits