sonusai 0.18.4__py3-none-any.whl → 0.18.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sonusai/mixture/mixdb.py CHANGED
@@ -1063,25 +1063,22 @@ class MixtureDatabase:
1063
1063
  if is_textgrid:
1064
1064
  for target in self.mixture(mixid).targets:
1065
1065
  data = get_textgrid_tier_from_target_file(self.target_file(target.file_id).name, tier)
1066
- if data is not None:
1067
- if isinstance(data, list):
1068
- # Check for tempo augmentation and adjust Interval start and end data as needed
1069
- entries = []
1070
- for entry in data:
1071
- if target.augmentation.tempo is not None:
1072
- entries.append(Interval(entry.start / target.augmentation.tempo,
1073
- entry.end / target.augmentation.tempo,
1074
- entry.label))
1075
- else:
1076
- entries.append(entry)
1077
- results.append(entries)
1078
- else:
1079
- results.append(data)
1066
+ if isinstance(data, list):
1067
+ # Check for tempo augmentation and adjust Interval start and end data as needed
1068
+ entries = []
1069
+ for entry in data:
1070
+ if target.augmentation.tempo is not None:
1071
+ entries.append(Interval(entry.start / target.augmentation.tempo,
1072
+ entry.end / target.augmentation.tempo,
1073
+ entry.label))
1074
+ else:
1075
+ entries.append(entry)
1076
+ results.append(entries)
1077
+ else:
1078
+ results.append(data)
1080
1079
  else:
1081
1080
  for target in self.mixture(mixid).targets:
1082
- data = self.speaker(self.target_file(target.file_id).speaker_id, tier)
1083
- if data is not None:
1084
- results.append(data)
1081
+ results.append(self.speaker(self.target_file(target.file_id).speaker_id, tier))
1085
1082
 
1086
1083
  return sorted(results)
1087
1084
 
@@ -1265,23 +1262,25 @@ class MixtureDatabase:
1265
1262
  # Otherwise, generate data as needed
1266
1263
  if m.startswith('mxwer'):
1267
1264
  parts = m.split('.')
1268
- if len(parts) != 3:
1265
+ if len(parts) != 2:
1269
1266
  raise SonusAIError(
1270
- f"Unrecognized 'mwwer' format: '{m}'; must be of the form: 'mxwer.<engine>.<model>'")
1271
- asr_engine = parts[1]
1272
- asr_model = parts[2]
1267
+ f"Unrecognized 'mxwer' format: '{m}'; must be of the form: 'mxwer.<name>'")
1268
+ asr_name = parts[1]
1269
+ asr_config = self.asr_configs.get(asr_name, None)
1270
+ if asr_config is None:
1271
+ raise SonusAIError(f"Unrecognized metric: '{m}'")
1273
1272
 
1274
- if asr_engine == 'none' or self.mixture(m_id).snr < -96:
1273
+ if self.mixture(m_id).snr < -96:
1275
1274
  # noise only, ignore/reset target asr
1276
1275
  return float('nan')
1277
1276
 
1278
1277
  # ignore mixup
1279
1278
  target_asr = self.mixture_speech_metadata(m_id, 'text')[0]
1280
1279
  if target_asr is None:
1281
- target_asr = calc_asr(target_audio(), engine=asr_engine, whisper_model_name=asr_model).text
1280
+ target_asr = calc_asr(target_audio(), **asr_config).text
1282
1281
 
1283
1282
  if target_asr:
1284
- mixture_asr = calc_asr(mixture_audio(), engine=asr_engine, whisper_model_name=asr_model).text
1283
+ mixture_asr = calc_asr(mixture_audio(), **asr_config).text
1285
1284
  return calc_wer(mixture_asr, target_asr).wer * 100
1286
1285
 
1287
1286
  # TODO: should this be NaN like above?
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sonusai
3
- Version: 0.18.4
3
+ Version: 0.18.6
4
4
  Summary: Framework for building deep neural network models for sound, speech, and voice AI
5
5
  Home-page: https://aaware.com
6
6
  License: GPL-3.0-only
@@ -46,7 +46,7 @@ sonusai/mixture/feature.py,sha256=Rwuf82IoXzhHPGbKYVGcatImF_ssBf_FfvbqghVPXtg,41
46
46
  sonusai/mixture/generation.py,sha256=W3n6ipI-dxg4Wj6YBJn8RTpFqkAyIXzxwObeFbSLq08,42801
47
47
  sonusai/mixture/helpers.py,sha256=eC9ZysEa-83VLKen_9PKWzr8w9dkHj4lp6rMB2fNLbg,24759
48
48
  sonusai/mixture/log_duration_and_sizes.py,sha256=baTUpqyM15wA125jo9E3posmVJUe3WlpksyO6v9Jul0,1347
49
- sonusai/mixture/mixdb.py,sha256=dtEuF2S4wg8G5pl_lkfly5k0kAg_g9xMukVLdb4G8iY,57458
49
+ sonusai/mixture/mixdb.py,sha256=WPXuziS0SePtKkd7qtkE7Db8rV-TKQoUBvs4GPieTek,57332
50
50
  sonusai/mixture/soundfile_audio.py,sha256=BwO4lftNvrhoPTJERONcrpxSpM2fjO6kL_e5Ylz742A,4220
51
51
  sonusai/mixture/sox_audio.py,sha256=Pu5RLE8lKKlGOzZsbfcVzbDvy7YPGBuGpbD_PxowFqA,12511
52
52
  sonusai/mixture/sox_augmentation.py,sha256=kBWPrsFk0EBi71nLcKt5v0GA34bY7g9D9x0cEamNWbU,4564
@@ -119,7 +119,7 @@ sonusai/utils/stratified_shuffle_split.py,sha256=rJNXvBp-GxoKzH3OpL7k0ANSu5xMP2z
119
119
  sonusai/utils/write_audio.py,sha256=ZsPGExwM86QHLLN2LOWekK2uAqf5pV_1oRW811p0QAI,840
120
120
  sonusai/utils/yes_or_no.py,sha256=eMLXBVH0cEahiXY4W2KNORmwNQ-ba10eRtldh0y4NYg,263
121
121
  sonusai/vars.py,sha256=m2AefF0m5bXWGXpJj8Pi42zWL2ydeEj7bkak3GrtMyM,940
122
- sonusai-0.18.4.dist-info/METADATA,sha256=8Q0ANLLD6sjL_HJgqY3rrAEyj6m2emeOgPeraSjnUZ4,2591
123
- sonusai-0.18.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
124
- sonusai-0.18.4.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
125
- sonusai-0.18.4.dist-info/RECORD,,
122
+ sonusai-0.18.6.dist-info/METADATA,sha256=L4wl__zTyqiH1SEMDPIIJcgLM7Uxqa6lQ9EMXVjXRlI,2591
123
+ sonusai-0.18.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
124
+ sonusai-0.18.6.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
125
+ sonusai-0.18.6.dist-info/RECORD,,