csukuangfj commited on
Commit
a275607
1 Parent(s): 5ec554b

add models

Browse files
Files changed (5) hide show
  1. export-onnx.py +19 -3
  2. model.int8.onnx +2 -2
  3. model.onnx +2 -2
  4. run.sh +2 -0
  5. speaker-diarization-torch.py +1 -0
export-onnx.py CHANGED
@@ -1,5 +1,7 @@
1
  #!/usr/bin/env python3
 
2
 
 
3
  from typing import Any, Dict
4
 
5
  import onnx
@@ -96,6 +98,20 @@ def main():
96
  receptive_field_size = int(model.receptive_field.duration * 16000)
97
  receptive_field_shift = int(model.receptive_field.step * 16000)
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  meta_data = {
100
  "num_speakers": len(model.specifications.classes),
101
  "powerset_max_classes": model.specifications.powerset_max_classes,
@@ -108,9 +124,9 @@ def main():
108
  "version": "1",
109
  "model_author": "pyannote",
110
  "maintainer": "k2-fsa",
111
- "url_1": "https://huggingface.co/pyannote/segmentation-3.0",
112
- "url_2": "https://huggingface.co/csukuangfj/pyannote-models/tree/main/segmentation-3.0",
113
- "license": "https://huggingface.co/pyannote/segmentation-3.0/blob/main/LICENSE",
114
  }
115
  add_meta_data(filename=filename, meta_data=meta_data)
116
 
 
1
  #!/usr/bin/env python3
2
+ # Copyright 2024 Xiaomi Corp. (authors: Fangjun Kuang)
3
 
4
+ import os
5
  from typing import Any, Dict
6
 
7
  import onnx
 
98
  receptive_field_size = int(model.receptive_field.duration * 16000)
99
  receptive_field_shift = int(model.receptive_field.step * 16000)
100
 
101
+ is_revai = os.getenv("SHERPA_ONNX_IS_REVAI", "")
102
+ if is_revai == "":
103
+ url_1 = "https://huggingface.co/pyannote/segmentation-3.0"
104
+ url_2 = "https://huggingface.co/csukuangfj/pyannote-models/tree/main/segmentation-3.0"
105
+ license_url = (
106
+ "https://huggingface.co/pyannote/segmentation-3.0/blob/main/LICENSE"
107
+ )
108
+ else:
109
+ url_1 = "https://huggingface.co/Revai/reverb-diarization-v1"
110
+ url_2 = "https://huggingface.co/csukuangfj/sherpa-onnx-reverb-diarization-v1"
111
+ license_url = (
112
+ "https://huggingface.co/Revai/reverb-diarization-v1/blob/main/LICENSE"
113
+ )
114
+
115
  meta_data = {
116
  "num_speakers": len(model.specifications.classes),
117
  "powerset_max_classes": model.specifications.powerset_max_classes,
 
124
  "version": "1",
125
  "model_author": "pyannote",
126
  "maintainer": "k2-fsa",
127
+ "url_1": url_1,
128
+ "url_2": url_2,
129
+ "license": license_url,
130
  }
131
  add_meta_data(filename=filename, meta_data=meta_data)
132
 
model.int8.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c0e83b2ca69b379eea37b80e2b739b1f6e43f3964c95aaac0bdeb5e2e225ec6e
3
- size 2415974
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eba77d4d983fd37d8cc0864b10b63bcd0c1864633b2917fb0d2aeb4b6055cf23
3
+ size 2415969
model.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d4d3926911a214a1e56df418f8d967f6dee3e139348a0738b6ef982fb3108fd4
3
- size 9512165
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08a5eb1dff82847656baa7bf022c85bd9c90dd5a6a1f1b06f3ebfca0482beb5a
3
+ size 9512160
run.sh CHANGED
@@ -1,6 +1,8 @@
1
  #!/usr/bin/env bash
2
  # Copyright 2024 Xiaomi Corp. (authors: Fangjun Kuang)
3
 
 
 
4
  set -ex
5
  function install_pyannote() {
6
  pip install pyannote.audio onnx onnxruntime
 
1
  #!/usr/bin/env bash
2
  # Copyright 2024 Xiaomi Corp. (authors: Fangjun Kuang)
3
 
4
+ export SHERPA_ONNX_IS_REVAI=1
5
+
6
  set -ex
7
  function install_pyannote() {
8
  pip install pyannote.audio onnx onnxruntime
speaker-diarization-torch.py CHANGED
@@ -1,4 +1,5 @@
1
  #!/usr/bin/env python3
 
2
 
3
  """
4
  Please refer to
 
1
  #!/usr/bin/env python3
2
+ # Copyright 2024 Xiaomi Corp. (authors: Fangjun Kuang)
3
 
4
  """
5
  Please refer to