sonusai 0.15.8__py3-none-any.whl → 0.16.0__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.
Files changed (59) hide show
  1. sonusai/__init__.py +35 -4
  2. sonusai/audiofe.py +237 -0
  3. sonusai/calc_metric_spenh.py +21 -12
  4. sonusai/genft.py +2 -1
  5. sonusai/genmixdb.py +5 -5
  6. sonusai/lsdb.py +2 -2
  7. sonusai/main.py +58 -61
  8. sonusai/mixture/__init__.py +4 -2
  9. sonusai/mixture/audio.py +0 -34
  10. sonusai/mixture/config.py +1 -2
  11. sonusai/mixture/datatypes.py +1 -1
  12. sonusai/mixture/feature.py +75 -21
  13. sonusai/mixture/helpers.py +60 -30
  14. sonusai/mixture/log_duration_and_sizes.py +2 -2
  15. sonusai/mixture/mixdb.py +13 -10
  16. sonusai/mixture/spectral_mask.py +14 -14
  17. sonusai/mixture/truth_functions/data.py +1 -1
  18. sonusai/mixture/truth_functions/target.py +2 -2
  19. sonusai/mkmanifest.py +29 -2
  20. sonusai/onnx_predict.py +1 -1
  21. sonusai/plot.py +4 -4
  22. sonusai/post_spenh_targetf.py +8 -8
  23. sonusai/utils/__init__.py +8 -7
  24. sonusai/utils/asl_p56.py +3 -3
  25. sonusai/utils/asr.py +35 -8
  26. sonusai/utils/asr_functions/__init__.py +0 -5
  27. sonusai/utils/asr_functions/aaware_whisper.py +2 -2
  28. sonusai/utils/asr_manifest_functions/__init__.py +1 -0
  29. sonusai/utils/asr_manifest_functions/mcgill_speech.py +29 -0
  30. sonusai/utils/audio_devices.py +41 -0
  31. sonusai/utils/calculate_input_shape.py +3 -4
  32. sonusai/utils/create_timestamp.py +5 -0
  33. sonusai/utils/{trim_docstring.py → docstring.py} +20 -0
  34. sonusai/utils/model_utils.py +30 -0
  35. sonusai/utils/onnx_utils.py +19 -45
  36. sonusai/utils/reshape.py +11 -11
  37. sonusai/utils/wave.py +12 -5
  38. {sonusai-0.15.8.dist-info → sonusai-0.16.0.dist-info}/METADATA +8 -19
  39. {sonusai-0.15.8.dist-info → sonusai-0.16.0.dist-info}/RECORD +41 -54
  40. {sonusai-0.15.8.dist-info → sonusai-0.16.0.dist-info}/WHEEL +1 -1
  41. sonusai/data_generator/__init__.py +0 -5
  42. sonusai/data_generator/dataset_from_mixdb.py +0 -143
  43. sonusai/data_generator/keras_from_mixdb.py +0 -169
  44. sonusai/data_generator/torch_from_mixdb.py +0 -122
  45. sonusai/evaluate.py +0 -245
  46. sonusai/keras_onnx.py +0 -86
  47. sonusai/keras_predict.py +0 -231
  48. sonusai/keras_train.py +0 -334
  49. sonusai/torchl_onnx.py +0 -216
  50. sonusai/torchl_predict.py +0 -547
  51. sonusai/torchl_train.py +0 -223
  52. sonusai/utils/asr_functions/aixplain_whisper.py +0 -59
  53. sonusai/utils/asr_functions/data.py +0 -16
  54. sonusai/utils/asr_functions/deepgram.py +0 -97
  55. sonusai/utils/asr_functions/fastwhisper.py +0 -90
  56. sonusai/utils/asr_functions/google.py +0 -95
  57. sonusai/utils/asr_functions/whisper.py +0 -49
  58. sonusai/utils/keras_utils.py +0 -226
  59. {sonusai-0.15.8.dist-info → sonusai-0.16.0.dist-info}/entry_points.txt +0 -0
@@ -1,27 +1,20 @@
1
- sonusai/__init__.py,sha256=KmIJ9wni9d9v5pyu0pUxbacZIHGkAywB9CJwl7JME28,1526
1
+ sonusai/__init__.py,sha256=ziSNMMCNS-tIp2ON1e7ST_xNLT-P8BvJfV2IxUvSJZs,2896
2
2
  sonusai/aawscd_probwrite.py,sha256=GukR5owp_0A3DrqSl9fHWULYgclNft4D5OkHIwfxxkc,3698
3
- sonusai/calc_metric_spenh.py,sha256=Cf02uYB6fzDX5anQuBTR_aD7mYt1WgxkEIzZA08uFvs,60825
3
+ sonusai/audiofe.py,sha256=v-GWrma5NNSukkPH427_6ilvFghUlDy4N9sfp_gvwCY,9303
4
+ sonusai/calc_metric_spenh.py,sha256=zJD9cuO4iXvOTuqDjpv-tJQg9bC7r5L7K74Av16lOk4,61762
4
5
  sonusai/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
6
  sonusai/data/genmixdb.yml,sha256=-XSs_hUR6wHJVoTPmSewzXL7u61X-xmHY46lNPatxSE,1025
6
7
  sonusai/data/speech_ma01_01.wav,sha256=PK0vMKg-NR6rPE3KouxHGF6PKXnJCr7AwjMqfu98LUA,76644
7
8
  sonusai/data/whitenoise.wav,sha256=I2umov0m34y56F9IsIBi1XtE76ZeZaSKDf70cJRe3pI,1920044
8
- sonusai/data_generator/__init__.py,sha256=ouCpY5EDV35fKFeKGQfIcU8uE-c3QcuNerTxUA1X5L8,232
9
- sonusai/data_generator/dataset_from_mixdb.py,sha256=Fe_7xxCYURvbZjuIZrvzozdkrx7ZO7gxGg8c5ob2dys,5478
10
- sonusai/data_generator/keras_from_mixdb.py,sha256=V5CUsGz-akIYdgQy9ABxwNKMYKv01klA4xtMDveF6uI,6167
11
- sonusai/data_generator/torch_from_mixdb.py,sha256=lvEe9DDu_rIaoyhv9PW4UAnAWp5N74L8kRfxUhsh7oo,4279
12
9
  sonusai/doc/__init__.py,sha256=rP5Hgn0Iys_xkuv4caxngdqehuU4zLZsiKuv8Nde67M,19
13
10
  sonusai/doc/doc.py,sha256=3z210v6ZckuOlsGZ3ySQBdlCNmBp2M1ahqhqG_eUN58,22664
14
11
  sonusai/doc.py,sha256=l8CaFgLI8mqx4tn0aXfxKqa2dy9GgC0zjYxZAkpmi1E,878
15
- sonusai/evaluate.py,sha256=1BX9dCXMHg6LefbvkevxYpjM3JR-i0jR3Eob2oNh_hQ,9983
16
- sonusai/genft.py,sha256=CeQN8Sxb_NKeXWJxN9HtzUu687eXl97nHBxzzCzQdLg,5557
12
+ sonusai/genft.py,sha256=6hOds8d-pYRawesLYh7XLrQh4PweWUj8U5Cbzx45bNQ,5572
17
13
  sonusai/genmix.py,sha256=0AiUfF7n0CGOp5v-woNfeP3-QaVQUb0CJZc0oXkvqpk,7016
18
- sonusai/genmixdb.py,sha256=onWkaCPzmUMvDtiGf3A7UdGkOA8xe9zuJTsuLfMdb_s,19597
14
+ sonusai/genmixdb.py,sha256=b-c22X7dd1ePLGrVuhVcn-AXHnxSrC5lTaR6KlrD1-4,19610
19
15
  sonusai/gentcst.py,sha256=8jeXirgJe0OGgknC8A-rIudjHeH8UTYPpuh71Ha-I3w,20165
20
- sonusai/keras_onnx.py,sha256=WHcPIcff4VPdiXqGX-TU-_x-UuKUD3nNpQtCX-2NEVQ,2658
21
- sonusai/keras_predict.py,sha256=ffrtI12T8_Rm26KsBee0dfEcnEuhOxvtV80YmbJR0m0,9085
22
- sonusai/keras_train.py,sha256=8_M5vY-CkonPzbOtOF3Vk-wox-42o8fkaOKLjk7Oc2k,13226
23
- sonusai/lsdb.py,sha256=qTEHQ5X9Ruc0ph4OUhYKFZ6xGC3gyhcNq7t25oyLhc8,5929
24
- sonusai/main.py,sha256=_s3WCFP_zQ7pD0OgdSVRPQRE38V5Qp6bG56JX-Y79ME,3120
16
+ sonusai/lsdb.py,sha256=TTMQ-0H8fFzUSczt6yjy-9xUjZSdIGQzTVH5Xr6XPSA,5941
17
+ sonusai/main.py,sha256=GC-pQrSqx9tWwIcmEo6V9SraEv5KskBLS_W_wz-f2ZM,2509
25
18
  sonusai/metrics/__init__.py,sha256=56itZW3S1I7ZYvbxPmFIVPAh1AIJZdljByz1uCrHqFE,635
26
19
  sonusai/metrics/calc_class_weights.py,sha256=dyY7daEIf5Ms5tfTf6wF0fkx_GnMADHOZR_rtsfGoVM,3933
27
20
  sonusai/metrics/calc_optimal_thresholds.py,sha256=9fRfwl-aKAbzHJyqGHv4o8BpZXG9HHB7zUJObHXfYM4,3522
@@ -35,24 +28,24 @@ sonusai/metrics/class_summary.py,sha256=4Mb25nuk6eqotnQSFMuOQL3zofGcpNXDfDlPa513
35
28
  sonusai/metrics/confusion_matrix_summary.py,sha256=3qg6TMKjJeHtNjj2YnNjPFSlMrQXt0Zcu1dLkGB_aPU,4001
36
29
  sonusai/metrics/one_hot.py,sha256=QSeH_GdqBpOAKLrNnQ8gjcPC-vSdUqC0yPEQueTA6VI,13548
37
30
  sonusai/metrics/snr_summary.py,sha256=P4U5_Xr7v9F8kF-rZBnpsVNt3p42rIVS6zmch8yfVfg,5575
38
- sonusai/mixture/__init__.py,sha256=WzPHGSWz6v64HCSFTGboG5o-xBy_0II4i4tkf1UL1Vw,5251
39
- sonusai/mixture/audio.py,sha256=6W2ihjJGBy7Xggx1imF7bzkymDuipPOgC63j2J7Wf-E,3456
31
+ sonusai/mixture/__init__.py,sha256=BfSJL91URq8-JDlbtpc5SQoQRWEUXvxKozbuquX4Mok,5326
32
+ sonusai/mixture/audio.py,sha256=S-ZROf5rVvwv1TCEuwJHz1FfX4oVubb4QhbybUMMqtM,2150
40
33
  sonusai/mixture/augmentation.py,sha256=Blb90tdTwBOj5w9tRcYyS5H67YJuFiXsGqwZWd7ON4g,10468
41
34
  sonusai/mixture/class_count.py,sha256=_wFnVl2yEOnbor7pLg7cYOUeX6nioov-03Cv3SEbh2k,996
42
- sonusai/mixture/config.py,sha256=CXIkVRJmaW2QW_sGl0aIqPf7I_TesyGhUYzxouw5UX4,22266
35
+ sonusai/mixture/config.py,sha256=d2IzZ1samHWGMpoKzSmUwMyAWWhgmyNoxyO8oiUwbsg,22193
43
36
  sonusai/mixture/constants.py,sha256=xjCskcQi6khqYZDf7j6z1OkeN1C6wE06kBBapcJiNI4,1428
44
- sonusai/mixture/datatypes.py,sha256=xN-GdPCEHGE2Ak_TdFbjuSyMs4x7TLRp59trbMTiYLg,8164
37
+ sonusai/mixture/datatypes.py,sha256=zaxfOHw8ddt-i8JPYOPnlqWz_EHBEDoO4q2VAqJViHM,8173
45
38
  sonusai/mixture/eq_rule_is_valid.py,sha256=MpQwRA5M76wSiQWEI1lW2cLFdPaMttBLcQp3tWD8efM,1243
46
- sonusai/mixture/feature.py,sha256=io6OiJAJ3GYvPChiUmPQuP3h0OB2onjYF8o9-AWkmqM,1996
39
+ sonusai/mixture/feature.py,sha256=Rwuf82IoXzhHPGbKYVGcatImF_ssBf_FfvbqghVPXtg,4116
47
40
  sonusai/mixture/generation.py,sha256=miUrc3QOSUNIG6mDkiMCZ6M2ulivUZxlYUAJUOVomWc,39039
48
- sonusai/mixture/helpers.py,sha256=XqpcB15MezEMVJwf3jxzATDJSpj_27b8Cru1TDIFD7w,21326
49
- sonusai/mixture/log_duration_and_sizes.py,sha256=r-wVjrLW1XBciOL4pkZSYMR7ZNADbojE95TPSQkp3kc,1329
41
+ sonusai/mixture/helpers.py,sha256=GSGSD2KnvOeEIB6IwNTxyaQNjghTSBMB729kUEd_RiM,22403
42
+ sonusai/mixture/log_duration_and_sizes.py,sha256=baTUpqyM15wA125jo9E3posmVJUe3WlpksyO6v9Jul0,1347
50
43
  sonusai/mixture/mapped_snr_f.py,sha256=mlbYM1t14OXe_Zg4CjpWTuA_Zun4W0O3bSUXeodRBQs,1845
51
- sonusai/mixture/mixdb.py,sha256=FQ5hirb2zR8Aj1UNtz89qJQ8wlE0ELC80IxQDmyhsKk,45188
44
+ sonusai/mixture/mixdb.py,sha256=9Pe0mEG8pnEf9NZynTIldc05GfdOrgmcVoIt63RG5DA,45279
52
45
  sonusai/mixture/soundfile_audio.py,sha256=Ow_IWIMz4pMsLxMP_JsQ8AuHLCWlYQinLa58CFW97f8,2804
53
46
  sonusai/mixture/sox_audio.py,sha256=HT3kYA9TP5QPCuoOJdUMnGVN-qY6q96DGL8zxuog76o,12277
54
47
  sonusai/mixture/sox_augmentation.py,sha256=F9tBdNvX2guCn7gRppAFrxRnBtjw9q6qAq2_v_A4hh0,4490
55
- sonusai/mixture/spectral_mask.py,sha256=LKFnrqZryPHT6FBNiT7yFxOeXc6-AUg6X54N26d8ctg,2107
48
+ sonusai/mixture/spectral_mask.py,sha256=8AkCwhy-PSdP1Uri9miKZP-bXFYnFcH_c9xZCGrHavU,2071
56
49
  sonusai/mixture/target_class_balancing.py,sha256=NTNiKZH0_PWLooeow0l41CjJKK8ZTMVbUqz9ZkaNtWk,4900
57
50
  sonusai/mixture/targets.py,sha256=wyy5vhLhuN-hqBMBGoziVvEJg3FKFvJFgmEE7_LaV2M,7908
58
51
  sonusai/mixture/tokenized_shell_vars.py,sha256=gCxw8SQUcal6mqWKF7hOBTgSQmbJUk1nT0Gn3H8GA0U,4705
@@ -61,68 +54,62 @@ sonusai/mixture/torchaudio_augmentation.py,sha256=1vEDHI0caL1vrgoY2lAWe4CiHE2jKR
61
54
  sonusai/mixture/truth.py,sha256=Y41pZ52Xkols9LUler0NlgnilUOscBIucmw4GcxXNzU,1612
62
55
  sonusai/mixture/truth_functions/__init__.py,sha256=82lKYHhLy8KW3gHngrocoqwupGVLVsWdIXdYs3vhjOc,359
63
56
  sonusai/mixture/truth_functions/crm.py,sha256=_Vy8UMrOUQXsrM3nutvUMWCpvI8GePr01QFlyqLFd4k,2626
64
- sonusai/mixture/truth_functions/data.py,sha256=NJNZz5fB3jnntUDlnsKJVQIeuHNUvD4x5iNaQVQlo3Y,2857
57
+ sonusai/mixture/truth_functions/data.py,sha256=okFJeOf43NxfdLqWFCBA2pOGqujRlNDYdAcwwR_m8z8,2875
65
58
  sonusai/mixture/truth_functions/energy.py,sha256=ydMtMLjMloG76DB30ZHQ5tkBVh4dkMJ82XEhKBokmIk,4281
66
59
  sonusai/mixture/truth_functions/file.py,sha256=jOJuC_3y9BH6GGOp9eKcbVrHLVRzUA80BJq59LhcBUM,1539
67
60
  sonusai/mixture/truth_functions/phoneme.py,sha256=stYdlPuNytQK_LLT61OJLfYSqKd-sDjQZdtJKGzt5wA,479
68
61
  sonusai/mixture/truth_functions/sed.py,sha256=8cHjEFjZaH_0hIOHhPmj4AJz2GpEADM6Ys2x4NoiWSY,2469
69
- sonusai/mixture/truth_functions/target.py,sha256=3rPXYwU4SBiPP3uIDpOL-B2Xw1Zh3JboD_MYNEyUpuk,5746
70
- sonusai/mkmanifest.py,sha256=dIPVFKKhnhHdq63OGr6p__pK7fyx3OdKVtbmGUJxsR8,7078
62
+ sonusai/mixture/truth_functions/target.py,sha256=KAsjugDRooOA5BRcHVAbZRgV7l8S5CFg7CZ0XtKZaQ0,5764
63
+ sonusai/mkmanifest.py,sha256=r6bQ6uoBVJIAviqNtJo7AZjXS8EhxdSAW-NHlhPzDCU,8646
71
64
  sonusai/mkwav.py,sha256=LZNyhq4gJEs_NtGvRsYHA2qfgkkODpt6HoH1b-Tjjuw,5266
72
- sonusai/onnx_predict.py,sha256=RhQbbNG3w6rCXuSFUWCaQmUH5JzSP2hmu6TG5_81IVA,9055
73
- sonusai/plot.py,sha256=GPrbk7SxwojtjR9KLE9jQ6ywYWXca296W0iaRPdnBHI,16982
74
- sonusai/post_spenh_targetf.py,sha256=Y9J5JbFnCFKCednNiYvVXaC5Z3lF5KxifFJ2RCy4jmg,4975
65
+ sonusai/onnx_predict.py,sha256=Bz_pR28oAZBarNajlKwyzBxmW7ktum77SmxDN2onKPM,9060
66
+ sonusai/plot.py,sha256=u-PvF8guNcm0b-GN99xfEkrcAAtidAEY3RLDzNvcyYk,17014
67
+ sonusai/post_spenh_targetf.py,sha256=NIMhDXeDuUqeWukNaAUMvDw9JpEVCauwjrL2F4M9nrI,4927
75
68
  sonusai/queries/__init__.py,sha256=oKY5JeqZ4Cz7DwCwPc1_ydB8bUs6KaMcWFp_w02TjOs,255
76
69
  sonusai/queries/queries.py,sha256=FNMUKnoY_Ya9S5sNhsB8ppwy0B7V55ilbbjhQRv_UN8,7552
77
- sonusai/torchl_onnx.py,sha256=5JYow3XpBaUdtuyAW0mOZyCKL_4FrHvEekYBRdDT6KA,8967
78
- sonusai/torchl_predict.py,sha256=-wlUdRGPjOvGjCQZY277D8tGeZp1KyDU7TpYH7ovC0c,26657
79
- sonusai/torchl_train.py,sha256=NPCRB0gwTvabivmOz78gjUreDeO1z16PYuw7L1-pIRQ,9680
80
70
  sonusai/tplot.py,sha256=yFyyyg9ymp2Eh-64Muu0EFFEY61MoJSV0a_fy9OWaCk,14485
81
- sonusai/utils/__init__.py,sha256=ynmdoPJVdbk5eYq9TA9t4QpGEkdiGATDx1pFu43u7YQ,2180
82
- sonusai/utils/asl_p56.py,sha256=GCKlz-NLInQ0z41XBi0mOvGdSfRZf3WI53necVNDo80,3837
83
- sonusai/utils/asr.py,sha256=QN1wdO9-EqD72-ixr4lnzsPfT8i0syhTGj1evKNJWe4,2021
84
- sonusai/utils/asr_functions/__init__.py,sha256=4boXXOXlQHTt8K2DWOwFXSlc8D2NLFd8QTc68yL2ejU,214
85
- sonusai/utils/asr_functions/aaware_whisper.py,sha256=6JnF8-a-39dYk4gVILWRUD5Ou98T6wPe9g4m8c6MF1A,1994
86
- sonusai/utils/asr_functions/aixplain_whisper.py,sha256=Fdg3z4HSw1zBu2CQGVU-e8xM3PLTh1Vn4c6fawBOWwQ,1694
87
- sonusai/utils/asr_functions/data.py,sha256=FQn-y63aOUooOjgKtkzkpFz5Gm9dwn3JPwcR0gC7fYA,418
88
- sonusai/utils/asr_functions/deepgram.py,sha256=sxFRDJn5EjSLv01G2lMoxXFHzXqFnA9ln4VcQWqGP80,5237
89
- sonusai/utils/asr_functions/fastwhisper.py,sha256=cyjC3U4UmBZstIvmpuUbNfrcgFFQd1-FLipDaK3_IpU,2856
90
- sonusai/utils/asr_functions/google.py,sha256=swzEKdod6EwGUKX8LJYcZPf6hJpuvsp9N6QJi7ip0yQ,3320
91
- sonusai/utils/asr_functions/whisper.py,sha256=IuOodbJY1RsiS3o18cVuBcIXn28TCGQz2BCFR1Up08s,1033
92
- sonusai/utils/asr_manifest_functions/__init__.py,sha256=Lz12aCGvfngZkLoUxHSqFjHc4wig4ZjQyFbWPWysgrI,310
71
+ sonusai/utils/__init__.py,sha256=TCXlcW8W0Up2f5ciSgz3DabvH1MxrrWD0LK6pQTJkeA,2215
72
+ sonusai/utils/asl_p56.py,sha256=-bvQpd-jRQVURbkZJpRoyEAq6gTv9Rc3oFDbh5_lcjY,3861
73
+ sonusai/utils/asr.py,sha256=6y6VYJizHpuQ3MgKbEQ4t2gofO-MW6Ez23oAd6d23IE,2920
74
+ sonusai/utils/asr_functions/__init__.py,sha256=JyHK67s97bw7QzrlkboWhws4yNytdPatqzLJxfwx-yw,43
75
+ sonusai/utils/asr_functions/aaware_whisper.py,sha256=LzO9CZV0wBWkjmCR2nSWN_AW9UJwriAsC1OYSlfVeT8,1981
76
+ sonusai/utils/asr_manifest_functions/__init__.py,sha256=V-w4R7SHUyoeDuMR3tS12j6DGhmfTlUibMKgq1c6ga0,370
93
77
  sonusai/utils/asr_manifest_functions/data.py,sha256=mJsaHccBReguOJu9qsshRhL-3GbeyqM0-PXMseFnZbE,151
94
78
  sonusai/utils/asr_manifest_functions/librispeech.py,sha256=HIaytcYmjRUkuR6fCQlv3Jh3IDWSox_A6WFcFFAHN9M,1635
79
+ sonusai/utils/asr_manifest_functions/mcgill_speech.py,sha256=2uF9qgBwcue9W9dlRo16Kvr3jX5g53AGjW2rwob-Cqk,957
95
80
  sonusai/utils/asr_manifest_functions/vctk_noisy_speech.py,sha256=-69lM0dz18KbU5_-dmSeqDoNNwgJj4UlxgGkNBEi3wM,2169
81
+ sonusai/utils/audio_devices.py,sha256=LgaXTln1oRArBzaet3rZiIO2plgtaThuGBc3sJ_sLlo,1414
96
82
  sonusai/utils/braced_glob.py,sha256=h4hab7YDbM4CjLg9iSzyHZrkd22IPUOY5zZqHdifkh8,1510
97
- sonusai/utils/calculate_input_shape.py,sha256=fyf8Ggxn9xljJ87BNwIzOh2KD4pKUGFZ2RNzE3195NI,1023
83
+ sonusai/utils/calculate_input_shape.py,sha256=63ILxibYKuTQozY83QN8Y2OOhBEbW_1X47Q0askcHDM,984
98
84
  sonusai/utils/convert_string_to_number.py,sha256=i17yIxurp8Iz6NPE-imTRlARrXWqadwm8qbOTuzHZvE,236
85
+ sonusai/utils/create_timestamp.py,sha256=TxoQXWZ3SFdBEHLOv-ujeIsTEJuiFnKOGRy-FQq45YU,148
99
86
  sonusai/utils/create_ts_name.py,sha256=8RLKmgXwuGcbDMGgtTuc0MvGFfA7IOVqfjkE2T18GOo,405
100
87
  sonusai/utils/dataclass_from_dict.py,sha256=vAGnuMjhy0W9bxZ5usrH7mbQsFog3n0__IC4xyJyVUc,390
101
88
  sonusai/utils/db.py,sha256=lI77MJJLs4CTYxhjFUvBom2Kk2imAP34okOeO4irbDc,371
89
+ sonusai/utils/docstring.py,sha256=JBecAq_a7KSzZ04tan0BlFA9SzhOQqY9A7Ue85kFQdU,1446
102
90
  sonusai/utils/energy_f.py,sha256=AsoGo3TCMnj9Kzqb9HUAYOL6vPGUseu1p-8z4LG-QYo,1462
103
91
  sonusai/utils/engineering_number.py,sha256=6lWRg-XW3FEllh-Zui1WHYcDnsBEY9cqcwcXPIs2-6o,5515
104
92
  sonusai/utils/get_frames_per_batch.py,sha256=xnq4tV7MT74N0H6b5ZsiAezqdXucboCLQw1Np9XpZbs,134
105
93
  sonusai/utils/get_label_names.py,sha256=bfFV_iFbXdtDp70zAz_CQQN9-QxBw_kt8vyAcr3TITM,828
106
94
  sonusai/utils/grouper.py,sha256=qyZ0nj84yOrC-RZsXHC-KJvcUliGktnV8S6-P3PD6_w,203
107
95
  sonusai/utils/human_readable_size.py,sha256=SjYT0fUlpbfCzCXHo6csir-VMwqfs5ogr-fgLCEqFk4,279
108
- sonusai/utils/keras_utils.py,sha256=1FJaaQE2yVYQqB6xTdgzjYKV_yvIA_hKob_uLOLf-0Y,8621
109
96
  sonusai/utils/max_text_width.py,sha256=pxiJMwb_zlkNntexgo7S6lAuF7NLLZvFdOCkxdsQJVY,315
97
+ sonusai/utils/model_utils.py,sha256=lt2KOGJqsinG71W0i3U29UXFO-47GMAlEabsf2um7bA,862
110
98
  sonusai/utils/numeric_conversion.py,sha256=GRO_2Fba8CcxcFY7bEXKOEUEUX6neA-VN__Bxi1ULsE,340
111
- sonusai/utils/onnx_utils.py,sha256=A3JyMvjV_0c3YZFEUD8tkT4Er_R4p1P0jjgrfcFXnRQ,3037
99
+ sonusai/utils/onnx_utils.py,sha256=BRsHGlcu5L0v_1z83MNy8TAcBeb7tJd_4OBJgOMLen8,2200
112
100
  sonusai/utils/parallel.py,sha256=bxedjCzBv9oxzU7NajRr6mOKmkCWr2P7FWAI0p2p9N8,1981
113
101
  sonusai/utils/print_mixture_details.py,sha256=BzYM4-wHHNa6zxPzBMUJxwKt0gKHmvbwdd7Yp0w15Yk,3017
114
102
  sonusai/utils/ranges.py,sha256=NPBZOVzMb95GTOIxltVO-wSzgcXqZ14wbdV46JDLKrw,1222
115
103
  sonusai/utils/read_mixture_data.py,sha256=Sb30RgSpw6DnH_iD81O7G_KOsdfjQWWLk3euEkxfMa8,453
116
104
  sonusai/utils/read_predict_data.py,sha256=5rR_ijrrcS2cKO1Sea2M2QEicokTtW5XtAo6jT5YSX8,1064
117
- sonusai/utils/reshape.py,sha256=sz-V4Za3DIvqFztTh0yYhQRcofnjc9XBW0CBhxg18lo,5854
105
+ sonusai/utils/reshape.py,sha256=E8Eu6grynaeWwVO6peIR0BF22SrVaJSa1Rkl109lq6Y,5997
118
106
  sonusai/utils/seconds_to_hms.py,sha256=oxLuZhTJJr9swj-fOSOrZJ5vBNM7_BrOMQhX1pYpiv0,260
119
107
  sonusai/utils/stacked_complex.py,sha256=feLhz3GC1ILxBGMHOj3sJK--sidsXKbfwkalwAVwizc,2950
120
108
  sonusai/utils/stratified_shuffle_split.py,sha256=rJNXvBp-GxoKzH3OpL7k0ANSu5xMP2zJ7K1fm_33UzE,7022
121
- sonusai/utils/trim_docstring.py,sha256=dSrtiRsEN4wkkvKBp6WDr13RUypfqZzgH_jOBLs1ouY,881
122
- sonusai/utils/wave.py,sha256=TKE-CNPGFXNXUW626CBPzCTNgWJut8I0ZEUsgG9q4Po,586
109
+ sonusai/utils/wave.py,sha256=O4ZXkZ6wjrKGa99wBCdFd8G6bp91MXXDnmGihpaEMh0,856
123
110
  sonusai/utils/yes_or_no.py,sha256=eMLXBVH0cEahiXY4W2KNORmwNQ-ba10eRtldh0y4NYg,263
124
111
  sonusai/vars.py,sha256=m2AefF0m5bXWGXpJj8Pi42zWL2ydeEj7bkak3GrtMyM,940
125
- sonusai-0.15.8.dist-info/METADATA,sha256=3eCpCJmXOfr7GV3a7HDWo0iilEVHB5ANdQqS59O0Yi0,2920
126
- sonusai-0.15.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
- sonusai-0.15.8.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
128
- sonusai-0.15.8.dist-info/RECORD,,
112
+ sonusai-0.16.0.dist-info/METADATA,sha256=MWrFI-GR33t2hVwlEwtLzzfEZiqO3mekRf7P7L8TaSk,2443
113
+ sonusai-0.16.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
114
+ sonusai-0.16.0.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
115
+ sonusai-0.16.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,5 +0,0 @@
1
- # SonusAI data generator classes
2
- from .keras_from_mixdb import KerasFromH5
3
- from .keras_from_mixdb import KerasFromMixtureDatabase
4
- from .torch_from_mixdb import AawareDataLoader
5
- from .torch_from_mixdb import TorchFromMixtureDatabase
@@ -1,143 +0,0 @@
1
- import math
2
- import warnings
3
- from dataclasses import dataclass
4
- from typing import Optional
5
-
6
- import numpy as np
7
-
8
- from sonusai.mixture import GeneralizedIDs
9
- from sonusai.mixture import MixtureDatabase
10
-
11
- with warnings.catch_warnings():
12
- warnings.simplefilter('ignore')
13
- from keras.utils import Sequence
14
-
15
-
16
- class DatasetFromMixtureDatabase(Sequence):
17
- """Generates data for Keras from a SonusAI mixture database
18
- """
19
-
20
- @dataclass(frozen=True)
21
- class BatchParams:
22
- mixids: list[int]
23
- offset: int
24
- extra: int
25
- padding: int
26
-
27
- def __init__(self,
28
- mixdb: MixtureDatabase,
29
- mixids: GeneralizedIDs,
30
- batch_size: int,
31
- timesteps: int,
32
- flatten: bool,
33
- add1ch: bool,
34
- shuffle: bool = False):
35
- """Initialization
36
- """
37
- self.mixdb = mixdb
38
- self.mixids = self.mixdb.mixids_to_list(mixids)
39
- self.batch_size = batch_size
40
- self.timesteps = timesteps
41
- self.flatten = flatten
42
- self.add1ch = add1ch
43
- self.shuffle = shuffle
44
- self.stride = self.mixdb.fg_stride
45
- self.num_bands = self.mixdb.fg_num_bands
46
- self.num_classes = self.mixdb.num_classes
47
- self.mixture_frame_segments = None
48
- self.batch_frame_segments = None
49
- self.total_batches: Optional[int] = None
50
-
51
- self._initialize_mixtures()
52
-
53
- def __len__(self) -> int:
54
- """Denotes the number of batches per epoch
55
- """
56
- return self.total_batches
57
-
58
- def __getitem__(self, batch_index: int) -> tuple[np.ndarray, np.ndarray]:
59
- """Get one batch of data
60
- """
61
- from sonusai.utils import reshape_inputs
62
-
63
- batch_params = self.batch_params[batch_index]
64
-
65
- result = [self.mixdb.mixture_ft(mixid) for mixid in batch_params.mixids]
66
- feature = np.vstack([result[i][0] for i in range(len(result))])
67
- truth = np.vstack([result[i][1] for i in range(len(result))])
68
-
69
- pad_shape = list(feature.shape)
70
- pad_shape[0] = batch_params.padding
71
- feature = np.vstack([feature, np.zeros(pad_shape)])
72
-
73
- pad_shape = list(truth.shape)
74
- pad_shape[0] = batch_params.padding
75
- truth = np.vstack([truth, np.zeros(pad_shape)])
76
-
77
- if batch_params.extra > 0:
78
- feature = feature[batch_params.offset:-batch_params.extra]
79
- truth = truth[batch_params.offset:-batch_params.extra]
80
- else:
81
- feature = feature[batch_params.offset:]
82
- truth = truth[batch_params.offset:]
83
-
84
- feature, truth = reshape_inputs(feature=feature,
85
- truth=truth,
86
- batch_size=self.batch_size,
87
- timesteps=self.timesteps,
88
- flatten=self.flatten,
89
- add1ch=self.add1ch)
90
-
91
- return feature, truth
92
-
93
- def on_epoch_end(self) -> None:
94
- """Modification of dataset between epochs
95
- """
96
- import random
97
-
98
- if self.shuffle:
99
- random.shuffle(self.mixids)
100
- self._initialize_mixtures()
101
-
102
- def _initialize_mixtures(self) -> None:
103
- from sonusai.utils import get_frames_per_batch
104
-
105
- frames_per_batch = get_frames_per_batch(self.batch_size, self.timesteps)
106
- # Always extend the number of batches to use all available data
107
- # The last batch may need padding
108
- self.total_batches = math.ceil(self.mixdb.total_feature_frames(self.mixids) / frames_per_batch)
109
-
110
- # Compute mixid, offset, and extra for dataset
111
- # offsets and extras are needed because mixtures are not guaranteed to fall on batch boundaries.
112
- # When fetching a new index that starts in the middle of a sequence of mixtures, the
113
- # previous feature frame offset must be maintained in order to preserve the correct
114
- # data sequence. And the extra must be maintained in order to preserve the correct data length.
115
- cumulative_frames = 0
116
- start_mixture_index = 0
117
- offset = 0
118
- self.batch_params = []
119
- self.file_indices = []
120
- total_frames = 0
121
- for idx, mixid in enumerate(self.mixids):
122
- current_frames = self.mixdb.mixture(mixid).samples // self.mixdb.feature_step_samples
123
- self.file_indices.append(slice(total_frames, total_frames + current_frames))
124
- total_frames += current_frames
125
- cumulative_frames += current_frames
126
- while cumulative_frames >= frames_per_batch:
127
- extra = cumulative_frames - frames_per_batch
128
- mixids = self.mixids[start_mixture_index:idx + 1]
129
- self.batch_params.append(self.BatchParams(mixids=mixids, offset=offset, extra=extra, padding=0))
130
- if extra == 0:
131
- start_mixture_index = idx + 1
132
- offset = 0
133
- else:
134
- start_mixture_index = idx
135
- offset = current_frames - extra
136
- cumulative_frames = extra
137
-
138
- # If needed, add final batch with padding
139
- needed_frames = self.total_batches * frames_per_batch
140
- padding = needed_frames - total_frames
141
- if padding != 0:
142
- mixids = self.mixids[start_mixture_index:]
143
- self.batch_params.append(self.BatchParams(mixids=mixids, offset=offset, extra=0, padding=padding))
@@ -1,169 +0,0 @@
1
- import warnings
2
- from dataclasses import dataclass
3
- from multiprocessing import get_context
4
- from os import cpu_count
5
- from typing import Optional
6
-
7
- import numpy as np
8
-
9
- from sonusai.mixture import Feature
10
- from sonusai.mixture import GeneralizedIDs
11
- from sonusai.mixture import MixtureDatabase
12
- from sonusai.mixture import Truth
13
-
14
- with warnings.catch_warnings():
15
- warnings.simplefilter('ignore')
16
- from keras.utils import Sequence
17
-
18
-
19
- @dataclass
20
- class MPGlobal:
21
- mixdb: MixtureDatabase = None
22
-
23
-
24
- MP_GLOBAL = MPGlobal()
25
-
26
-
27
- def _pool_initializer(location: str) -> None:
28
- MP_GLOBAL.mixdb = MixtureDatabase(location)
29
-
30
-
31
- def _pool_kernel(mixid: int) -> tuple[Feature, Truth]:
32
- return MP_GLOBAL.mixdb.mixture_ft(mixid)
33
-
34
-
35
- class KerasFromMixtureDatabase(Sequence):
36
- """Generates data for Keras from a SonusAI mixture database
37
- """
38
-
39
- @dataclass(frozen=True)
40
- class BatchParams:
41
- mixids: list[int]
42
- offset: int
43
- extra: int
44
- padding: int
45
-
46
- def __init__(self,
47
- mixdb: MixtureDatabase,
48
- mixids: GeneralizedIDs,
49
- batch_size: int,
50
- timesteps: int,
51
- flatten: bool,
52
- add1ch: bool,
53
- shuffle: bool = False):
54
- """Initialization
55
- """
56
- self.mixdb = mixdb
57
- self.mixids = self.mixdb.mixids_to_list(mixids)
58
- self.batch_size = batch_size
59
- self.timesteps = timesteps
60
- self.flatten = flatten
61
- self.add1ch = add1ch
62
- self.shuffle = shuffle
63
- self.stride = self.mixdb.fg_stride
64
- self.num_bands = self.mixdb.fg_num_bands
65
- self.num_classes = self.mixdb.num_classes
66
- self.mixture_frame_segments: Optional[int] = None
67
- self.batch_frame_segments: Optional[int] = None
68
- self.total_batches: Optional[int] = None
69
-
70
- self._initialize_mixtures()
71
-
72
- self.pool = get_context('fork').Pool(processes=cpu_count(),
73
- initializer=_pool_initializer,
74
- initargs=(self.mixdb.location,))
75
-
76
- def __len__(self) -> int:
77
- """Denotes the number of batches per epoch
78
- """
79
- return self.total_batches
80
-
81
- def __getitem__(self, batch_index: int) -> tuple[np.ndarray, np.ndarray]:
82
- """Get one batch of data
83
- """
84
- from sonusai.utils import reshape_inputs
85
-
86
- batch_params = self.batch_params[batch_index]
87
-
88
- result = self.pool.map(_pool_kernel, batch_params.mixids)
89
- feature = np.vstack([result[i][0] for i in range(len(result))])
90
- truth = np.vstack([result[i][1] for i in range(len(result))])
91
-
92
- pad_shape = list(feature.shape)
93
- pad_shape[0] = batch_params.padding
94
- feature = np.vstack([feature, np.zeros(pad_shape)])
95
-
96
- pad_shape = list(truth.shape)
97
- pad_shape[0] = batch_params.padding
98
- truth = np.vstack([truth, np.zeros(pad_shape)])
99
-
100
- if batch_params.extra > 0:
101
- feature = feature[batch_params.offset:-batch_params.extra]
102
- truth = truth[batch_params.offset:-batch_params.extra]
103
- else:
104
- feature = feature[batch_params.offset:]
105
- truth = truth[batch_params.offset:]
106
-
107
- feature, truth = reshape_inputs(feature=feature,
108
- truth=truth,
109
- batch_size=self.batch_size,
110
- timesteps=self.timesteps,
111
- flatten=self.flatten,
112
- add1ch=self.add1ch)
113
-
114
- return feature, truth
115
-
116
- def on_epoch_end(self) -> None:
117
- """Modification of dataset between epochs
118
- """
119
- import random
120
-
121
- if self.shuffle:
122
- random.shuffle(self.mixids)
123
- self._initialize_mixtures()
124
-
125
- def _initialize_mixtures(self) -> None:
126
- from sonusai.utils import get_frames_per_batch
127
-
128
- frames_per_batch = get_frames_per_batch(self.batch_size, self.timesteps)
129
- # Always extend the number of batches to use all available data
130
- # The last batch may need padding
131
- self.total_batches = int(np.ceil(self.mixdb.total_feature_frames(self.mixids) / frames_per_batch))
132
-
133
- # Compute mixid, offset, and extra for dataset
134
- # offsets and extras are needed because mixtures are not guaranteed to fall on batch boundaries.
135
- # When fetching a new index that starts in the middle of a sequence of mixtures, the
136
- # previous feature frame offset must be maintained in order to preserve the correct
137
- # data sequence. And the extra must be maintained in order to preserve the correct data length.
138
- cumulative_frames = 0
139
- start_mixture_index = 0
140
- offset = 0
141
- self.batch_params = []
142
- self.file_indices = []
143
- total_frames = 0
144
- for idx, mixid in enumerate(self.mixids):
145
- current_frames = self.mixdb.mixture(mixid).samples // self.mixdb.feature_step_samples
146
- self.file_indices.append(slice(total_frames, total_frames + current_frames))
147
- total_frames += current_frames
148
- cumulative_frames += current_frames
149
- while cumulative_frames >= frames_per_batch:
150
- extra = cumulative_frames - frames_per_batch
151
- mixids = self.mixids[start_mixture_index:idx + 1]
152
- self.batch_params.append(self.BatchParams(mixids=mixids, offset=offset, extra=extra, padding=0))
153
- if extra == 0:
154
- start_mixture_index = idx + 1
155
- offset = 0
156
- else:
157
- start_mixture_index = idx
158
- offset = current_frames - extra
159
- cumulative_frames = extra
160
-
161
- # If needed, add final batch with padding
162
- needed_frames = self.total_batches * frames_per_batch
163
- padding = needed_frames - total_frames
164
- if padding != 0:
165
- mixids = self.mixids[start_mixture_index:]
166
- self.batch_params.append(self.BatchParams(mixids=mixids, offset=offset, extra=0, padding=padding))
167
-
168
-
169
- KerasFromH5 = KerasFromMixtureDatabase
@@ -1,122 +0,0 @@
1
- from typing import Optional
2
-
3
- import numpy as np
4
- from torch.utils.data import DataLoader
5
- from torch.utils.data import Dataset
6
- from torch.utils.data import Sampler
7
-
8
- from sonusai.mixture import GeneralizedIDs
9
- from sonusai.mixture import MixtureDatabase
10
-
11
-
12
- class MixtureDatabaseDataset(Dataset):
13
- """Generates a PyTorch dataset from a SonusAI mixture database
14
- """
15
-
16
- def __init__(self,
17
- mixdb: MixtureDatabase,
18
- mixids: GeneralizedIDs,
19
- cut_len: int,
20
- flatten: bool,
21
- add1ch: bool,
22
- random_cut: bool = True):
23
- """Initialization
24
- """
25
- self.mixdb = mixdb
26
- self.mixids = self.mixdb.mixids_to_list(mixids)
27
- self.cut_len = cut_len
28
- self.flatten = flatten
29
- self.add1ch = add1ch
30
- self.random_cut = random_cut
31
-
32
- def __len__(self):
33
- return len(self.mixids)
34
-
35
- def __getitem__(self, idx: int) -> tuple[np.ndarray, np.ndarray, int]:
36
- """Get data from one mixture
37
- """
38
- import random
39
-
40
- from sonusai.utils import reshape_inputs
41
-
42
- feature, truth = self.mixdb.mixture_ft(self.mixids[idx])
43
- feature, truth = reshape_inputs(feature=feature,
44
- truth=truth,
45
- batch_size=1,
46
- timesteps=0,
47
- flatten=self.flatten,
48
- add1ch=self.add1ch)
49
-
50
- length = feature.shape[0]
51
-
52
- if self.cut_len > 0:
53
- if length < self.cut_len:
54
- feature_final = []
55
- truth_final = []
56
- for _ in range(self.cut_len // length):
57
- feature_final.append(feature)
58
- truth_final.append(truth)
59
- feature_final.append(feature[: self.cut_len % length])
60
- truth_final.append(truth[: self.cut_len % length])
61
- feature = np.vstack([feature_final[i] for i in range(len(feature_final))])
62
- truth = np.vstack([truth_final[i] for i in range(len(truth_final))])
63
- else:
64
- if self.random_cut:
65
- start = random.randint(0, length - self.cut_len)
66
- else:
67
- start = 0
68
- feature = feature[start:start + self.cut_len]
69
- truth = truth[start:start + self.cut_len]
70
-
71
- return feature, truth, idx
72
-
73
-
74
- class AawareDataLoader(DataLoader):
75
- _cut_len: Optional[int] = None
76
-
77
- @property
78
- def cut_len(self) -> int:
79
- return self._cut_len
80
-
81
- @cut_len.setter
82
- def cut_len(self, value: int) -> None:
83
- self._cut_len = value
84
-
85
-
86
- def TorchFromMixtureDatabase(mixdb: MixtureDatabase,
87
- mixids: GeneralizedIDs,
88
- batch_size: int,
89
- flatten: bool,
90
- add1ch: bool,
91
- num_workers: int = 0,
92
- cut_len: int = 0,
93
- drop_last: bool = False,
94
- shuffle: bool = False,
95
- random_cut: bool = True,
96
- sampler: Optional[type[Sampler]] = None,
97
- pin_memory: bool = False) -> AawareDataLoader:
98
- """Generates a PyTorch dataloader from a SonusAI mixture database
99
- """
100
- dataset = MixtureDatabaseDataset(mixdb=mixdb,
101
- mixids=mixids,
102
- cut_len=cut_len,
103
- flatten=flatten,
104
- add1ch=add1ch,
105
- random_cut=random_cut)
106
-
107
- if sampler is not None:
108
- my_sampler = sampler(dataset)
109
- else:
110
- my_sampler = None
111
-
112
- result = AawareDataLoader(dataset=dataset,
113
- batch_size=batch_size,
114
- pin_memory=pin_memory,
115
- shuffle=shuffle,
116
- sampler=my_sampler,
117
- drop_last=drop_last,
118
- num_workers=num_workers)
119
-
120
- result.cut_len = cut_len
121
-
122
- return result