asahi417 commited on
Commit
dcc9bd4
1 Parent(s): 7974918
Files changed (1) hide show
  1. experiment_voxceleb1.py +4 -2
experiment_voxceleb1.py CHANGED
@@ -2,7 +2,7 @@ import json
2
  import os
3
  from os.path import join as p_join
4
  from tqdm import tqdm
5
-
6
  from datasets import load_dataset
7
 
8
  from model_meta_voice import MetaVoiceSE
@@ -22,13 +22,15 @@ def get_embedding(model_class, model_name: str):
22
  model = model_class()
23
  embeddings = []
24
  for i in tqdm(voxceleb1_dataset, total=len(voxceleb1_dataset)):
 
25
  v = model.get_speaker_embedding(i["audio"]["array"], i["audio"]["sampling_rate"])
26
  embeddings.append({
27
  "model": model_name,
28
  "embedding": v.tolist(),
29
  "sampling_rate": i["audio"]["sampling_rate"],
30
  "id": i["id"],
31
- "speaker_id": i["speaker_id"]
 
32
  })
33
  with open(file_path, "w") as f:
34
  f.write("\n".join([json.dumps(i) for i in embeddings]))
 
2
  import os
3
  from os.path import join as p_join
4
  from tqdm import tqdm
5
+ from time import time
6
  from datasets import load_dataset
7
 
8
  from model_meta_voice import MetaVoiceSE
 
22
  model = model_class()
23
  embeddings = []
24
  for i in tqdm(voxceleb1_dataset, total=len(voxceleb1_dataset)):
25
+ start = time()
26
  v = model.get_speaker_embedding(i["audio"]["array"], i["audio"]["sampling_rate"])
27
  embeddings.append({
28
  "model": model_name,
29
  "embedding": v.tolist(),
30
  "sampling_rate": i["audio"]["sampling_rate"],
31
  "id": i["id"],
32
+ "speaker_id": i["speaker_id"],
33
+ "process_time": time() - start
34
  })
35
  with open(file_path, "w") as f:
36
  f.write("\n".join([json.dumps(i) for i in embeddings]))