bweng commited on
Commit
7fbc165
·
verified ·
1 Parent(s): 1b5bcb8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -3
README.md CHANGED
@@ -1,3 +1,51 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ Pyannote and wespeaker models converted for Speaker diarization and identification for OpenVINO
6
+
7
+
8
+ Load Audio File
9
+
10
+ ```python
11
+ import librosa
12
+ import matplotlib.pyplot as plt
13
+ import librosa.display
14
+ import IPython.display as ipd
15
+
16
+ sample_file = "tutorials_assets_sample.wav"
17
+ audio, sr = librosa.load(sample_file)
18
+ waveform = torch.from_numpy(audio[0:160000]).unsqueeze(0).unsqueeze(0)
19
+ plt.figure(figsize=(14, 5))
20
+ librosa.display.waveshow(audio, sr=sr)
21
+
22
+ ipd.Audio(sample_file)
23
+ ```
24
+
25
+ Loading the pyannote model
26
+ ```python
27
+ core = ov.Core()
28
+ model = core.read_model("pyannote-segmentation.xml")
29
+ compiled_model = core.compile_model(model, "NPU") # or "NPU" if supported
30
+ input_name = compiled_model.input(0)
31
+ output_name = compiled_model.output(0)
32
+
33
+ results = compiled_model({input_name: waveform})
34
+ output = results[output_name]
35
+ output.sum(axis=1)
36
+ ```
37
+
38
+
39
+ Loading the embedding model
40
+ ```python
41
+ core = ov.Core()
42
+ embedding_openvino_model = core.read_model("pyannote-wespeaker.xml")
43
+ embedding_openvino_model.reshape((1, 100, 80))
44
+ compiled_model = core.compile_model(embedding_openvino_model, "NPU") # or "NPU" if supported
45
+ input_name = compiled_model.input(0)
46
+ output_name = compiled_model.output(0)
47
+
48
+ results = compiled_model({input_name: torch.zeros((1, 100, 80))})
49
+ output = results[output_name]
50
+ output.sum(axis=1)
51
+ ```