neverlib 0.2.8__py3-none-any.whl → 0.2.9__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 (430) hide show
  1. neverlib/QA/ImpactNoiseRejection.py +119 -0
  2. neverlib/QA/impact_noise_rejection.png +0 -0
  3. neverlib/QA/out.pcm +0 -0
  4. neverlib/QA/out.wav +0 -0
  5. neverlib/audio_aug/README.md +3 -0
  6. neverlib/audio_aug/__init__.py +0 -54
  7. neverlib/data_analyze/__init__.py +0 -44
  8. neverlib/filter/__init__.py +0 -23
  9. neverlib/filter/auto_eq/__init__.py +0 -36
  10. neverlib/filter/core.py +8 -5
  11. neverlib/metrics/README.md +35 -0
  12. neverlib/metrics/__init__.py +0 -36
  13. neverlib/metrics/pesq_c/PESQ +0 -0
  14. neverlib/signal_gen/babble_noise_generate.py +113 -0
  15. neverlib/tests/__init__.py +0 -17
  16. neverlib/utils/README.md +29 -0
  17. neverlib/utils/__init__.py +6 -50
  18. neverlib/utils/audio_split.py +20 -20
  19. neverlib/utils/checkGPU.py +52 -79
  20. neverlib/utils/floder.py +115 -0
  21. neverlib/utils/pcm.py +42 -0
  22. neverlib/utils/utils.py +3 -92
  23. neverlib/vad/__init__.py +0 -38
  24. {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/METADATA +15 -1
  25. neverlib-0.2.9.dist-info/RECORD +119 -0
  26. neverlib/.claude/settings.local.json +0 -9
  27. neverlib/.history/Docs/audio_aug/del_20250827162530.py +0 -0
  28. neverlib/.history/Docs/audio_aug/del_20250827162540.py +0 -2
  29. neverlib/.history/Docs/audio_aug/del_20250827162541.py +0 -7
  30. neverlib/.history/Docs/audio_aug/del_20250827162606.py +0 -7
  31. neverlib/.history/Docs/audio_aug/del_20250827162637.py +0 -8
  32. neverlib/.history/Docs/audio_aug/del_20250827162645.py +0 -8
  33. neverlib/.history/Docs/audio_aug/del_20250827162723.py +0 -9
  34. neverlib/.history/Docs/audio_aug/del_20250827162739.py +0 -9
  35. neverlib/.history/Docs/audio_aug/test_snr_20250806011311.py +0 -0
  36. neverlib/.history/Docs/audio_aug/test_snr_20250806011331.py +0 -75
  37. neverlib/.history/Docs/audio_aug/test_snr_20250806011342.py +0 -57
  38. neverlib/.history/Docs/audio_aug/test_snr_20250806011352.py +0 -57
  39. neverlib/.history/Docs/audio_aug/test_snr_20250806011403.py +0 -57
  40. neverlib/.history/Docs/audio_aug/test_snr_20250806011413.py +0 -57
  41. neverlib/.history/Docs/audio_aug/test_snr_20250806011435.py +0 -55
  42. neverlib/.history/Docs/audio_aug/test_snr_20250827161751.py +0 -55
  43. neverlib/.history/Docs/audio_aug/test_snr_20250827161754.py +0 -55
  44. neverlib/.history/Docs/audio_aug/test_snr_20250827161833.py +0 -54
  45. neverlib/.history/Docs/audio_aug/test_snr_20250827162017.py +0 -56
  46. neverlib/.history/Docs/audio_aug/test_snr_20250827162021.py +0 -57
  47. neverlib/.history/Docs/audio_aug/test_snr_20250827162028.py +0 -57
  48. neverlib/.history/Docs/audio_aug/test_snr_20250827162033.py +0 -55
  49. neverlib/.history/Docs/audio_aug_test/del_20250827162738.py +0 -9
  50. neverlib/.history/Docs/audio_aug_test/del_20250827162819.py +0 -9
  51. neverlib/.history/Docs/audio_aug_test/del_20250827162830.py +0 -9
  52. neverlib/.history/Docs/audio_aug_test/del_20250827162846.py +0 -9
  53. neverlib/.history/Docs/audio_aug_test/del_20250827162851.py +0 -9
  54. neverlib/.history/Docs/audio_aug_test/del_20250827162903.py +0 -10
  55. neverlib/.history/Docs/audio_aug_test/del_20250827162921.py +0 -10
  56. neverlib/.history/Docs/audio_aug_test/del_20250827162926.py +0 -10
  57. neverlib/.history/Docs/audio_aug_test/del_20250827163030.py +0 -10
  58. neverlib/.history/Docs/audio_aug_test/del_20250827163032.py +0 -10
  59. neverlib/.history/Docs/vad/1_20250810032405.py +0 -0
  60. neverlib/.history/Docs/vad/1_20250810032417.py +0 -39
  61. neverlib/.history/QA/html2markdown_20250822234112.md +0 -0
  62. neverlib/.history/QA/html2markdown_20250822234140.py +0 -9
  63. neverlib/.history/QA/html2markdown_20250822234141.md +0 -9
  64. neverlib/.history/QA/html2markdown_20250822234159.py +0 -12
  65. neverlib/.history/QA/html2markdown_20250822234200.py +0 -17
  66. neverlib/.history/QA/html2markdown_20250822234236.py +0 -17
  67. neverlib/.history/QA/html2markdown_20250822234340.py +0 -14
  68. neverlib/.history/QA/html2markdown_20250822234522.py +0 -18
  69. neverlib/.history/QA/html2markdown_20250822234601.py +0 -20
  70. neverlib/.history/QA/html2markdown_20250822234615.py +0 -22
  71. neverlib/.history/QA/html2markdown_20250822234715.py +0 -28
  72. neverlib/.history/QA/html2markdown_20250822234720.py +0 -27
  73. neverlib/.history/QA/html2markdown_20250822234903.py +0 -27
  74. neverlib/.history/__init___20250805234212.py +0 -41
  75. neverlib/.history/__init___20250904102635.py +0 -39
  76. neverlib/.history/__init___20250904102836.py +0 -34
  77. neverlib/.history/__init___20250904102838.py +0 -39
  78. neverlib/.history/__init___20250904102851.py +0 -33
  79. neverlib/.history/audio_aug/audio_aug_20250806010451.py +0 -125
  80. neverlib/.history/audio_aug/audio_aug_20250806010750.py +0 -138
  81. neverlib/.history/audio_aug/audio_aug_20250806010759.py +0 -140
  82. neverlib/.history/audio_aug/audio_aug_20250806010803.py +0 -140
  83. neverlib/.history/audio_aug/audio_aug_20250806010809.py +0 -140
  84. neverlib/.history/audio_aug/audio_aug_20250806011108.py +0 -140
  85. neverlib/.history/audio_aug/audio_aug_20250826155913.py +0 -158
  86. neverlib/.history/audio_aug/audio_aug_20250826164159.py +0 -159
  87. neverlib/.history/audio_aug/audio_aug_20250826164217.py +0 -160
  88. neverlib/.history/audio_aug/audio_aug_20250826164408.py +0 -161
  89. neverlib/.history/audio_aug/audio_aug_20250826164423.py +0 -161
  90. neverlib/.history/audio_aug/audio_aug_20250826164529.py +0 -161
  91. neverlib/.history/audio_aug/audio_aug_20250826164824.py +0 -161
  92. neverlib/.history/audio_aug/audio_aug_20250826164932.py +0 -162
  93. neverlib/.history/audio_aug/audio_aug_20250826164947.py +0 -162
  94. neverlib/.history/audio_aug/audio_aug_20250826165403.py +0 -162
  95. neverlib/.history/audio_aug/audio_aug_20250826165421.py +0 -162
  96. neverlib/.history/audio_aug/audio_aug_20250826165509.py +0 -163
  97. neverlib/.history/audio_aug/audio_aug_20250826165702.py +0 -163
  98. neverlib/.history/audio_aug/audio_aug_20250826165732.py +0 -165
  99. neverlib/.history/audio_aug/audio_aug_20250826170041.py +0 -163
  100. neverlib/.history/audio_aug/audio_aug_20250826170105.py +0 -164
  101. neverlib/.history/audio_aug/audio_aug_20250826170154.py +0 -164
  102. neverlib/.history/audio_aug/audio_aug_20250826170220.py +0 -165
  103. neverlib/.history/audio_aug/audio_aug_20250826170221.py +0 -165
  104. neverlib/.history/audio_aug/audio_aug_20250826170228.py +0 -165
  105. neverlib/.history/audio_aug/audio_aug_20250826170231.py +0 -165
  106. neverlib/.history/audio_aug/audio_aug_20250826212001.py +0 -165
  107. neverlib/.history/audio_aug/audio_aug_20250826220038.py +0 -165
  108. neverlib/.history/audio_aug/audio_aug_20250826220133.py +0 -165
  109. neverlib/.history/audio_aug/audio_aug_20250826220148.py +0 -165
  110. neverlib/.history/audio_aug/audio_aug_20250826220154.py +0 -165
  111. neverlib/.history/audio_aug/audio_aug_20250826220156.py +0 -165
  112. neverlib/.history/audio_aug/audio_aug_20250826220314.py +0 -165
  113. neverlib/.history/audio_aug/audio_aug_20250826220343.py +0 -184
  114. neverlib/.history/audio_aug/audio_aug_20250826220345.py +0 -184
  115. neverlib/.history/audio_aug/audio_aug_20250826220349.py +0 -184
  116. neverlib/.history/audio_aug/audio_aug_20250826220429.py +0 -184
  117. neverlib/.history/audio_aug/audio_aug_20250826220447.py +0 -184
  118. neverlib/.history/audio_aug/audio_aug_20250826220601.py +0 -186
  119. neverlib/.history/audio_aug/audio_aug_20250826220638.py +0 -186
  120. neverlib/.history/audio_aug/audio_aug_20250826220641.py +0 -186
  121. neverlib/.history/audio_aug/audio_aug_20250826220647.py +0 -186
  122. neverlib/.history/audio_aug/audio_aug_20250826220653.py +0 -186
  123. neverlib/.history/audio_aug/audio_aug_20250826220655.py +0 -186
  124. neverlib/.history/audio_aug/audio_aug_20250826220731.py +0 -185
  125. neverlib/.history/audio_aug/audio_aug_20250826220739.py +0 -185
  126. neverlib/.history/audio_aug/audio_aug_20250826220747.py +0 -185
  127. neverlib/.history/audio_aug/audio_aug_20250826220801.py +0 -186
  128. neverlib/.history/audio_aug/audio_aug_20250826220822.py +0 -186
  129. neverlib/.history/audio_aug/audio_aug_20250826220901.py +0 -186
  130. neverlib/.history/audio_aug/audio_aug_20250826221107.py +0 -187
  131. neverlib/.history/audio_aug/audio_aug_20250826221310.py +0 -188
  132. neverlib/.history/audio_aug/audio_aug_20250826221353.py +0 -191
  133. neverlib/.history/audio_aug/audio_aug_20250826221821.py +0 -191
  134. neverlib/.history/audio_aug/audio_aug_20250826221838.py +0 -191
  135. neverlib/.history/audio_aug/audio_aug_20250826221906.py +0 -191
  136. neverlib/.history/audio_aug/audio_aug_20250826221930.py +0 -191
  137. neverlib/.history/audio_aug/audio_aug_20250826221939.py +0 -191
  138. neverlib/.history/audio_aug/audio_aug_20250826221955.py +0 -191
  139. neverlib/.history/audio_aug/audio_aug_20250826222008.py +0 -197
  140. neverlib/.history/audio_aug/audio_aug_20250826222017.py +0 -200
  141. neverlib/.history/audio_aug/audio_aug_20250826222046.py +0 -203
  142. neverlib/.history/audio_aug/audio_aug_20250826222105.py +0 -203
  143. neverlib/.history/audio_aug/audio_aug_20250826222206.py +0 -203
  144. neverlib/.history/audio_aug/audio_aug_20250826222302.py +0 -203
  145. neverlib/.history/audio_aug/audio_aug_20250826222336.py +0 -203
  146. neverlib/.history/audio_aug/audio_aug_20250826222455.py +0 -204
  147. neverlib/.history/audio_aug/audio_aug_20250826222526.py +0 -204
  148. neverlib/.history/audio_aug/audio_aug_20250826222541.py +0 -204
  149. neverlib/.history/audio_aug/audio_aug_20250826222624.py +0 -202
  150. neverlib/.history/audio_aug/audio_aug_20250826222714.py +0 -205
  151. neverlib/.history/audio_aug/audio_aug_20250826222820.py +0 -205
  152. neverlib/.history/audio_aug/audio_aug_20250826222827.py +0 -205
  153. neverlib/.history/audio_aug/audio_aug_20250826222927.py +0 -232
  154. neverlib/.history/audio_aug/audio_aug_20250826223009.py +0 -232
  155. neverlib/.history/audio_aug/audio_aug_20250826223054.py +0 -232
  156. neverlib/.history/audio_aug/audio_aug_20250826223225.py +0 -233
  157. neverlib/.history/audio_aug/audio_aug_20250826223344.py +0 -236
  158. neverlib/.history/audio_aug/audio_aug_20250826223356.py +0 -236
  159. neverlib/.history/audio_aug/audio_aug_20250826223955.py +0 -242
  160. neverlib/.history/audio_aug/audio_aug_20250826224210.py +0 -240
  161. neverlib/.history/audio_aug/audio_aug_20250826224250.py +0 -242
  162. neverlib/.history/audio_aug/audio_aug_20250826224323.py +0 -280
  163. neverlib/.history/audio_aug/audio_aug_20250826224452.py +0 -263
  164. neverlib/.history/audio_aug/audio_aug_20250826224455.py +0 -263
  165. neverlib/.history/audio_aug/audio_aug_20250826224502.py +0 -263
  166. neverlib/.history/audio_aug/audio_aug_20250826224528.py +0 -263
  167. neverlib/.history/audio_aug/audio_aug_20250826224658.py +0 -263
  168. neverlib/.history/audio_aug/audio_aug_20250826224833.py +0 -264
  169. neverlib/.history/audio_aug/audio_aug_20250826225013.py +0 -269
  170. neverlib/.history/audio_aug/audio_aug_20250826225050.py +0 -269
  171. neverlib/.history/audio_aug/audio_aug_20250826225241.py +0 -268
  172. neverlib/.history/audio_aug/audio_aug_20250826225315.py +0 -266
  173. neverlib/.history/audio_aug/audio_aug_20250826225404.py +0 -266
  174. neverlib/.history/audio_aug/audio_aug_20250826225502.py +0 -265
  175. neverlib/.history/audio_aug/audio_aug_20250826225950.py +0 -267
  176. neverlib/.history/audio_aug/audio_aug_20250826225959.py +0 -268
  177. neverlib/.history/audio_aug/audio_aug_20250826230222.py +0 -271
  178. neverlib/.history/audio_aug/audio_aug_20250826230248.py +0 -270
  179. neverlib/.history/audio_aug/audio_aug_20250826230638.py +0 -266
  180. neverlib/.history/audio_aug/audio_aug_20250826230755.py +0 -266
  181. neverlib/.history/audio_aug/audio_aug_20250826230941.py +0 -265
  182. neverlib/.history/audio_aug/audio_aug_20250826231054.py +0 -266
  183. neverlib/.history/audio_aug/audio_aug_20250826231117.py +0 -266
  184. neverlib/.history/audio_aug/audio_aug_20250826231219.py +0 -266
  185. neverlib/.history/audio_aug/audio_aug_20250826232330.py +0 -266
  186. neverlib/.history/audio_aug/audio_aug_20250826232352.py +0 -266
  187. neverlib/.history/audio_aug/audio_aug_20250827152748.py +0 -268
  188. neverlib/.history/audio_aug/audio_aug_20250827152806.py +0 -268
  189. neverlib/.history/audio_aug/audio_aug_20250827152808.py +0 -268
  190. neverlib/.history/audio_aug/audio_aug_20250827152917.py +0 -283
  191. neverlib/.history/audio_aug/audio_aug_20250827152929.py +0 -281
  192. neverlib/.history/audio_aug/audio_aug_20250827153100.py +0 -286
  193. neverlib/.history/audio_aug/audio_aug_20250827153102.py +0 -286
  194. neverlib/.history/audio_aug/audio_aug_20250827153301.py +0 -295
  195. neverlib/.history/audio_aug/audio_aug_20250827153331.py +0 -298
  196. neverlib/.history/audio_aug/audio_aug_20250827153525.py +0 -303
  197. neverlib/.history/audio_aug/audio_aug_20250827153533.py +0 -304
  198. neverlib/.history/audio_aug/audio_aug_20250827153541.py +0 -321
  199. neverlib/.history/audio_aug/audio_aug_20250827153805.py +0 -322
  200. neverlib/.history/audio_aug/audio_aug_20250827153832.py +0 -323
  201. neverlib/.history/audio_aug/audio_aug_20250827153836.py +0 -324
  202. neverlib/.history/audio_aug/audio_aug_20250827153846.py +0 -324
  203. neverlib/.history/audio_aug/audio_aug_20250827153859.py +0 -325
  204. neverlib/.history/audio_aug/audio_aug_20250827154453.py +0 -337
  205. neverlib/.history/audio_aug/audio_aug_20250827154513.py +0 -355
  206. neverlib/.history/audio_aug/audio_aug_20250827154538.py +0 -356
  207. neverlib/.history/audio_aug/audio_aug_20250827154541.py +0 -357
  208. neverlib/.history/audio_aug/audio_aug_20250827154612.py +0 -357
  209. neverlib/.history/audio_aug/audio_aug_20250827154657.py +0 -360
  210. neverlib/.history/audio_aug/audio_aug_20250827154708.py +0 -360
  211. neverlib/.history/audio_aug/audio_aug_20250827154728.py +0 -366
  212. neverlib/.history/audio_aug/audio_aug_20250827154755.py +0 -367
  213. neverlib/.history/audio_aug/audio_aug_20250827154800.py +0 -367
  214. neverlib/.history/audio_aug/audio_aug_20250827154917.py +0 -368
  215. neverlib/.history/audio_aug/audio_aug_20250827154928.py +0 -369
  216. neverlib/.history/audio_aug/audio_aug_20250827154932.py +0 -370
  217. neverlib/.history/audio_aug/audio_aug_20250827154947.py +0 -372
  218. neverlib/.history/audio_aug/audio_aug_20250827155015.py +0 -375
  219. neverlib/.history/audio_aug/audio_aug_20250827155106.py +0 -375
  220. neverlib/.history/audio_aug/audio_aug_20250827155114.py +0 -393
  221. neverlib/.history/audio_aug/audio_aug_20250827155207.py +0 -415
  222. neverlib/.history/audio_aug/audio_aug_20250827155300.py +0 -415
  223. neverlib/.history/audio_aug/audio_aug_20250827155321.py +0 -471
  224. neverlib/.history/audio_aug/audio_aug_20250827164703.py +0 -471
  225. neverlib/.history/audio_aug/audio_aug_20250827164749.py +0 -471
  226. neverlib/.history/audio_aug/audio_aug_20250827165252.py +0 -472
  227. neverlib/.history/audio_aug/audio_aug_20250827165334.py +0 -472
  228. neverlib/.history/audio_aug/audio_aug_20250827165404.py +0 -473
  229. neverlib/.history/audio_aug/audio_aug_20250827165610.py +0 -473
  230. neverlib/.history/audio_aug/audio_aug_20250827165805.py +0 -473
  231. neverlib/.history/audio_aug/audio_aug_20250827170056.py +0 -473
  232. neverlib/.history/audio_aug/audio_aug_20250827170106.py +0 -472
  233. neverlib/.history/audio_aug/audio_aug_20250827170143.py +0 -472
  234. neverlib/.history/audio_aug/audio_aug_20250827170216.py +0 -472
  235. neverlib/.history/audio_aug/audio_aug_20250827170218.py +0 -472
  236. neverlib/.history/audio_aug/audio_aug_20250827170314.py +0 -472
  237. neverlib/.history/audio_aug/audio_aug_20250827171500.py +0 -471
  238. neverlib/.history/audio_aug/audio_aug_20250827172347.py +0 -471
  239. neverlib/.history/audio_aug/audio_aug_20250827172558.py +0 -470
  240. neverlib/.history/audio_aug/audio_aug_20250827172559.py +0 -470
  241. neverlib/.history/audio_aug/audio_aug_20250827172801.py +0 -470
  242. neverlib/.history/audio_aug/audio_aug_20250827182522.py +0 -470
  243. neverlib/.history/audio_aug/audio_aug_20250827182526.py +0 -470
  244. neverlib/.history/audio_aug/audio_aug_20250827182626.py +0 -470
  245. neverlib/.history/audio_aug/audio_aug_20250827182715.py +0 -470
  246. neverlib/.history/audio_aug/audio_aug_20250904185444.py +0 -470
  247. neverlib/.history/audio_aug/audio_aug_20250904185538.py +0 -445
  248. neverlib/.history/dataAnalyze/__init___20250805234204.py +0 -87
  249. neverlib/.history/dataAnalyze/__init___20250806204125.py +0 -14
  250. neverlib/.history/dataAnalyze/__init___20250806204139.py +0 -14
  251. neverlib/.history/dataAnalyze/__init___20250806204159.py +0 -14
  252. neverlib/.history/data_analyze/__init___20250806204158.py +0 -14
  253. neverlib/.history/data_analyze/__init___20250827163248.py +0 -14
  254. neverlib/.history/filter/__init___20250820103351.py +0 -70
  255. neverlib/.history/filter/__init___20250821102348.py +0 -70
  256. neverlib/.history/filter/__init___20250821102405.py +0 -14
  257. neverlib/.history/filter/auto_eq/__init___20250819213121.py +0 -36
  258. neverlib/.history/filter/auto_eq/__init___20250821102241.py +0 -36
  259. neverlib/.history/filter/auto_eq/__init___20250821102259.py +0 -36
  260. neverlib/.history/filter/auto_eq/__init___20250821102307.py +0 -36
  261. neverlib/.history/filter/auto_eq/__init___20250821102310.py +0 -36
  262. neverlib/.history/filter/auto_eq/__init___20250821102318.py +0 -36
  263. neverlib/.history/filter/auto_eq/__init___20250821102507.py +0 -36
  264. neverlib/.history/filter/auto_eq/de_eq_20250820103848.py +0 -361
  265. neverlib/.history/filter/auto_eq/de_eq_20250821102422.py +0 -360
  266. neverlib/.history/filter/auto_eq/freq_eq_20250805234206.py +0 -75
  267. neverlib/.history/filter/auto_eq/freq_eq_20250820140732.py +0 -75
  268. neverlib/.history/filter/auto_eq/freq_eq_20250820140745.py +0 -75
  269. neverlib/.history/filter/auto_eq/freq_eq_20250820140816.py +0 -75
  270. neverlib/.history/filter/auto_eq/freq_eq_20250820140938.py +0 -77
  271. neverlib/.history/filter/auto_eq/freq_eq_20250820141003.py +0 -77
  272. neverlib/.history/filter/auto_eq/freq_eq_20250820141006.py +0 -77
  273. neverlib/.history/filter/auto_eq/freq_eq_20250820141019.py +0 -77
  274. neverlib/.history/filter/auto_eq/freq_eq_20250820141049.py +0 -77
  275. neverlib/.history/filter/auto_eq/freq_eq_20250820141211.py +0 -77
  276. neverlib/.history/filter/auto_eq/freq_eq_20250820141227.py +0 -77
  277. neverlib/.history/filter/auto_eq/freq_eq_20250820141311.py +0 -78
  278. neverlib/.history/filter/auto_eq/freq_eq_20250820141340.py +0 -78
  279. neverlib/.history/filter/auto_eq/freq_eq_20250820141712.py +0 -78
  280. neverlib/.history/filter/auto_eq/freq_eq_20250820141733.py +0 -78
  281. neverlib/.history/filter/auto_eq/freq_eq_20250820141755.py +0 -78
  282. neverlib/.history/filter/auto_eq/freq_eq_20250821102434.py +0 -76
  283. neverlib/.history/filter/auto_eq/freq_eq_20250821102500.py +0 -76
  284. neverlib/.history/filter/auto_eq/freq_eq_20250821102502.py +0 -76
  285. neverlib/.history/filter/auto_eq/freq_eq_20250821143140.py +0 -76
  286. neverlib/.history/filter/auto_eq/freq_eq_20250821153208.py +0 -76
  287. neverlib/.history/filter/auto_eq/freq_eq_20250821153214.py +0 -76
  288. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820102957.py +0 -380
  289. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113054.py +0 -380
  290. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113150.py +0 -380
  291. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113520.py +0 -385
  292. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113525.py +0 -385
  293. neverlib/.history/filter/auto_eq/ga_eq_basic_20250821102212.py +0 -385
  294. neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110521.py +0 -385
  295. neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110652.py +0 -385
  296. neverlib/.history/filter/common_20250806002134.py +0 -37
  297. neverlib/.history/filter/common_20250821120448.py +0 -49
  298. neverlib/.history/filter/common_20250821120453.py +0 -49
  299. neverlib/.history/metrics/dnsmos_20250806001612.py +0 -160
  300. neverlib/.history/metrics/dnsmos_20250815180659.py +0 -160
  301. neverlib/.history/metrics/dnsmos_20250815180701.py +0 -158
  302. neverlib/.history/metrics/dnsmos_20250815181321.py +0 -154
  303. neverlib/.history/metrics/dnsmos_20250815181327.py +0 -154
  304. neverlib/.history/metrics/dnsmos_20250815181331.py +0 -154
  305. neverlib/.history/metrics/dnsmos_20250815181620.py +0 -154
  306. neverlib/.history/metrics/dnsmos_20250815181631.py +0 -154
  307. neverlib/.history/metrics/dnsmos_20250815181742.py +0 -154
  308. neverlib/.history/metrics/dnsmos_20250815181824.py +0 -153
  309. neverlib/.history/metrics/dnsmos_20250815181834.py +0 -153
  310. neverlib/.history/metrics/dnsmos_20250815181922.py +0 -153
  311. neverlib/.history/metrics/dnsmos_20250815182011.py +0 -147
  312. neverlib/.history/metrics/dnsmos_20250815182036.py +0 -144
  313. neverlib/.history/metrics/dnsmos_20250815182936.py +0 -143
  314. neverlib/.history/metrics/dnsmos_20250815182942.py +0 -143
  315. neverlib/.history/metrics/dnsmos_20250815183032.py +0 -137
  316. neverlib/.history/metrics/dnsmos_20250815183101.py +0 -144
  317. neverlib/.history/metrics/dnsmos_20250815183121.py +0 -144
  318. neverlib/.history/metrics/dnsmos_20250815183123.py +0 -143
  319. neverlib/.history/metrics/dnsmos_20250815183214.py +0 -143
  320. neverlib/.history/metrics/dnsmos_20250815183240.py +0 -143
  321. neverlib/.history/metrics/dnsmos_20250815183248.py +0 -144
  322. neverlib/.history/metrics/dnsmos_20250815183407.py +0 -142
  323. neverlib/.history/metrics/dnsmos_20250815183409.py +0 -142
  324. neverlib/.history/metrics/dnsmos_20250815183431.py +0 -142
  325. neverlib/.history/metrics/dnsmos_20250815183507.py +0 -140
  326. neverlib/.history/metrics/dnsmos_20250815183513.py +0 -139
  327. neverlib/.history/metrics/dnsmos_20250815183618.py +0 -139
  328. neverlib/.history/metrics/dnsmos_20250815183709.py +0 -140
  329. neverlib/.history/metrics/dnsmos_20250815183756.py +0 -137
  330. neverlib/.history/metrics/dnsmos_20250815183815.py +0 -128
  331. neverlib/.history/metrics/dnsmos_20250815183827.py +0 -129
  332. neverlib/.history/metrics/dnsmos_20250815183913.py +0 -117
  333. neverlib/.history/metrics/dnsmos_20250815183914.py +0 -117
  334. neverlib/.history/metrics/dnsmos_20250815184003.py +0 -118
  335. neverlib/.history/metrics/dnsmos_20250815184040.py +0 -118
  336. neverlib/.history/metrics/dnsmos_20250815184049.py +0 -118
  337. neverlib/.history/metrics/dnsmos_20250815184104.py +0 -117
  338. neverlib/.history/metrics/dnsmos_20250815184200.py +0 -117
  339. neverlib/.history/metrics/lpc_lsp_metric_20250816015944.py +0 -128
  340. neverlib/.history/metrics/lpc_lsp_metric_20250816020142.py +0 -128
  341. neverlib/.history/metrics/lpc_lsp_metric_20250816020156.py +0 -128
  342. neverlib/.history/metrics/lpc_lsp_metric_20250816020554.py +0 -130
  343. neverlib/.history/metrics/lpc_lsp_metric_20250816020600.py +0 -125
  344. neverlib/.history/metrics/lpc_lsp_metric_20250816020631.py +0 -120
  345. neverlib/.history/metrics/lpc_lsp_metric_20250816020746.py +0 -118
  346. neverlib/.history/metrics/lpc_me_20250816013111.py +0 -0
  347. neverlib/.history/metrics/lpc_me_20250816013129.py +0 -121
  348. neverlib/.history/metrics/lpc_me_20250816015430.py +0 -103
  349. neverlib/.history/metrics/lpc_me_20250816015535.py +0 -96
  350. neverlib/.history/metrics/lpc_me_20250816015542.py +0 -96
  351. neverlib/.history/metrics/lpc_me_20250816015636.py +0 -97
  352. neverlib/.history/metrics/lpc_me_20250816015658.py +0 -104
  353. neverlib/.history/metrics/lpc_me_20250816015703.py +0 -100
  354. neverlib/.history/metrics/lpc_me_20250816015945.py +0 -128
  355. neverlib/.history/metrics/snr_20250806010538.py +0 -177
  356. neverlib/.history/metrics/snr_20250806211634.py +0 -184
  357. neverlib/.history/metrics/snr_20250827224201.py +0 -182
  358. neverlib/.history/metrics/snr_20250827234019.py +0 -186
  359. neverlib/.history/metrics/snr_20250827234028.py +0 -186
  360. neverlib/.history/metrics/snr_20250827234030.py +0 -186
  361. neverlib/.history/metrics/spec_20250805234209.py +0 -45
  362. neverlib/.history/metrics/spec_20250816135530.py +0 -11
  363. neverlib/.history/metrics/spec_20250816135654.py +0 -16
  364. neverlib/.history/metrics/spec_20250816135736.py +0 -68
  365. neverlib/.history/metrics/spec_20250816135904.py +0 -75
  366. neverlib/.history/metrics/spec_20250816135921.py +0 -82
  367. neverlib/.history/metrics/spec_20250816140111.py +0 -82
  368. neverlib/.history/metrics/spec_20250816140543.py +0 -136
  369. neverlib/.history/metrics/spec_20250816140559.py +0 -172
  370. neverlib/.history/metrics/spec_20250816140602.py +0 -172
  371. neverlib/.history/metrics/spec_20250816140608.py +0 -172
  372. neverlib/.history/metrics/spec_20250816140654.py +0 -148
  373. neverlib/.history/metrics/spec_20250816140705.py +0 -144
  374. neverlib/.history/metrics/spec_20250816140755.py +0 -138
  375. neverlib/.history/metrics/spec_20250816140823.py +0 -170
  376. neverlib/.history/metrics/spec_20250816140832.py +0 -170
  377. neverlib/.history/metrics/spec_20250816140833.py +0 -170
  378. neverlib/.history/metrics/spec_20250816140922.py +0 -147
  379. neverlib/.history/metrics/spec_20250816141148.py +0 -107
  380. neverlib/.history/metrics/spec_20250816141219.py +0 -123
  381. neverlib/.history/metrics/spec_20250816141732.py +0 -178
  382. neverlib/.history/metrics/spec_20250816141740.py +0 -178
  383. neverlib/.history/metrics/spec_20250816142030.py +0 -178
  384. neverlib/.history/metrics/spec_20250816142107.py +0 -135
  385. neverlib/.history/metrics/spec_20250816142126.py +0 -135
  386. neverlib/.history/metrics/spec_20250816142410.py +0 -135
  387. neverlib/.history/metrics/spec_20250816142415.py +0 -136
  388. neverlib/.history/metrics/spec_metric_20250816135156.py +0 -0
  389. neverlib/.history/metrics/spec_metric_20250816135226.py +0 -5
  390. neverlib/.history/metrics/spec_metric_20250816135227.py +0 -10
  391. neverlib/.history/metrics/spec_metric_20250816135306.py +0 -15
  392. neverlib/.history/metrics/spec_metric_20250816135442.py +0 -31
  393. neverlib/.history/metrics/spec_metric_20250816135448.py +0 -31
  394. neverlib/.history/metrics/spec_metric_20250816135520.py +0 -29
  395. neverlib/.history/metrics/spec_metric_20250816135537.py +0 -63
  396. neverlib/.history/metrics/spec_metric_20250816135653.py +0 -65
  397. neverlib/.history/utils/audio_split_20250805234209.py +0 -268
  398. neverlib/.history/utils/audio_split_20250904185309.py +0 -268
  399. neverlib/.history/utils/utils_20250813165516.py +0 -330
  400. neverlib/.history/utils/utils_20250904181341.py +0 -328
  401. neverlib/.history/utils/utils_20250904185546.py +0 -352
  402. neverlib/.history/utils/utils_20250904185548.py +0 -353
  403. neverlib/.history/utils/utils_20250904185603.py +0 -353
  404. neverlib/.history/utils/utils_20250904185636.py +0 -353
  405. neverlib/.history/utils/utils_20250904185658.py +0 -358
  406. neverlib/.history/utils/utils_20250904190053.py +0 -359
  407. neverlib/.history/vad/PreProcess_20250805234211.py +0 -63
  408. neverlib/.history/vad/PreProcess_20250809232455.py +0 -63
  409. neverlib/.history/vad/PreProcess_20250816020725.py +0 -66
  410. neverlib/.history/vad/VAD_Silero_20250805234211.py +0 -50
  411. neverlib/.history/vad/VAD_Silero_20250809232456.py +0 -50
  412. neverlib/.history/vad/VAD_WebRTC_20250805234211.py +0 -61
  413. neverlib/.history/vad/VAD_WebRTC_20250809232456.py +0 -61
  414. neverlib/.history/vad/VAD_funasr_20250805234211.py +0 -54
  415. neverlib/.history/vad/VAD_funasr_20250809232456.py +0 -54
  416. neverlib/.history/vad/VAD_vadlib_20250805234211.py +0 -70
  417. neverlib/.history/vad/VAD_vadlib_20250809232455.py +0 -70
  418. neverlib/.history/vad/VAD_whisper_20250805234211.py +0 -55
  419. neverlib/.history/vad/VAD_whisper_20250809232456.py +0 -55
  420. neverlib/.specstory/.what-is-this.md +0 -69
  421. neverlib/.specstory/history/2025-08-05_17-06Z-/350/277/231/344/270/200/346/255/245/347/232/204/347/233/256/347/232/204/346/230/257/344/273/200/344/271/210.md +0 -424
  422. neverlib/.specstory/history/2025-08-22_02-10Z-/345/256/214/345/226/204/345/207/275/346/225/260/347/232/204/345/212/237/350/203/275/345/222/214/345/217/230/351/207/217/345/220/215/345/273/272/350/256/256.md +0 -247
  423. neverlib/.specstory/history/2025-08-26_11-54Z-oserror-missing-shared-object-file.md +0 -87
  424. neverlib/.specstory/history/2025-08-27_08-07Z-/345/256/214/345/226/204/346/265/213/350/257/225/346/226/207/346/241/243/347/232/204/350/256/250/350/256/272.md +0 -296
  425. neverlib/.specstory/history/2025-08-27_08-29Z-delete-python-file-command.md +0 -211
  426. neverlib/.specstory/history/2025-08-27_09-05Z-/345/234/250jupyter/344/270/255/346/222/255/346/224/276/351/237/263/351/242/221/347/232/204/344/273/243/347/240/201/344/277/256/346/224/271.md +0 -357
  427. neverlib-0.2.8.dist-info/RECORD +0 -510
  428. {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/WHEEL +0 -0
  429. {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/licenses/LICENSE +0 -0
  430. {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/top_level.txt +0 -0
@@ -12,20 +12,20 @@ import numpy as np
12
12
  from .utils import get_path_list
13
13
 
14
14
 
15
- def audio_split_ffmpeg(source_path, target_path, sr, channel_num, duration, endwith="*.pcm"):
15
+ def audio_split_ffmpeg(source_dir, target_dir, sr, channel_num, duration, endwith="*.pcm"):
16
16
  """ 切割音频切不准, 会留点尾巴0.016s
17
17
  使用ffmpeg分割音频, 分割为短音频(单位:秒), 似乎无法非常准确的分割到指定长度
18
- :param source_path: 源音频路径
19
- :param target_path: 目标音频路径
18
+ :param source_dir: 源音频路径
19
+ :param target_dir: 目标音频路径
20
20
  :param sr: 源音频采样率
21
21
  :param channel_num: 源音频声道数
22
22
  :param duration: 分割为时长(短音频)(单位:秒)
23
23
  :param endwith: 音频格式(支持pcm和wav)
24
24
  """
25
- wav_path_list = get_path_list(source_path, end=endwith)
25
+ wav_path_list = get_path_list(source_dir, end=endwith)
26
26
  print("待分割的音频数: ", len(wav_path_list))
27
27
  for wav_path in wav_path_list:
28
- wav_folder = wav_path[:-4].replace(source_path, target_path)
28
+ wav_folder = wav_path[:-4].replace(source_dir, target_dir)
29
29
  os.makedirs(wav_folder, exist_ok=True)
30
30
 
31
31
  if endwith == "*.pcm":
@@ -45,19 +45,19 @@ def audio_split_ffmpeg(source_path, target_path, sr, channel_num, duration, endw
45
45
  print("分割完毕: done!")
46
46
 
47
47
 
48
- def audio_split_sox(source_path, target_path, duration, endwith="*.wav"):
48
+ def audio_split_sox(source_dir, target_dir, duration, endwith="*.wav"):
49
49
  """
50
50
  使用sox分割音频, 分割为短音频(单位:秒), 可以非常准确的分割到指定长度
51
- :param source_path: 源音频路径
52
- :param target_path: 目标音频路径
51
+ :param source_dir: 源音频路径
52
+ :param target_dir: 目标音频路径
53
53
  :param duration: 分割为时长(短音频)(单位:秒)
54
54
  :param endwith: 音频格式(只支持wav)
55
55
  """
56
56
  assert endwith == "*.wav", "只支持wav格式的音频"
57
- wav_path_list = get_path_list(source_path, end=endwith)
57
+ wav_path_list = get_path_list(source_dir, end=endwith)
58
58
 
59
59
  for wav_path in wav_path_list:
60
- wav_folder = wav_path[:-4].replace(source_path, target_path)
60
+ wav_folder = wav_path[:-4].replace(source_dir, target_dir)
61
61
  os.makedirs(wav_folder, exist_ok=True)
62
62
 
63
63
  output_pattern = f"{wav_folder}/%.wav"
@@ -71,25 +71,25 @@ def audio_split_sox(source_path, target_path, duration, endwith="*.wav"):
71
71
  print("分割完毕: done!")
72
72
 
73
73
 
74
- def audio_split_np(source_path, target_path, sr, channel_num, duration, endwith="*.pcm"):
74
+ def audio_split_np(source_dir, target_dir, sr, channel_num, duration, endwith="*.pcm"):
75
75
  """
76
76
  使用numpy读取pcm文件并切割保存为wav文件, 保持通道数一致, 保存不足30秒的最后一段音频
77
- :param source_path: 源音频路径
78
- :param target_path: 目标音频路径
77
+ :param source_dir: 源音频路径
78
+ :param target_dir: 目标音频路径
79
79
  :param sr: 采样率
80
80
  :param channel_num: 声道数
81
81
  :param duration: 分割的时长 (秒)
82
82
  :param endwith: 音频格式 (支持 pcm)
83
83
  """
84
84
  assert endwith == "*.pcm", "只支持pcm格式的音频"
85
- wav_path_list = get_path_list(source_path, end=endwith) # 获取音频文件列表
85
+ wav_path_list = get_path_list(source_dir, end=endwith) # 获取音频文件列表
86
86
  print("待分割的音频数: ", len(wav_path_list))
87
87
 
88
88
  segment_length_samples = duration * sr # 每个切片音频的采样点数
89
89
 
90
90
  for wav_path in wav_path_list:
91
91
  print("正在分割: ", wav_path)
92
- wav_folder = wav_path[:-4].replace(source_path, target_path)
92
+ wav_folder = wav_path[:-4].replace(source_dir, target_dir)
93
93
  os.makedirs(wav_folder, exist_ok=True)
94
94
 
95
95
  # 注意读取时使用正确的dtype(例如int16表示16位PCM)
@@ -119,11 +119,11 @@ def audio_split_np(source_path, target_path, sr, channel_num, duration, endwith=
119
119
  print("分割完毕: done!")
120
120
 
121
121
 
122
- def audio_split_pydub(source_path, target_path, sr, channel_num, duration, endwith="*.pcm", sample_width=2):
122
+ def audio_split_pydub(source_dir, target_dir, sr, channel_num, duration, endwith="*.pcm", sample_width=2):
123
123
  """
124
124
  使用pydub分割音频, 进行精确的分割
125
- :param source_path: 源音频路径
126
- :param target_path: 目标音频路径
125
+ :param source_dir: 源音频路径
126
+ :param target_dir: 目标音频路径
127
127
  :param sr: 源音频采样率
128
128
  :param channel_num: 源音频声道数
129
129
  :param duration: 分割为时长(短音频)(单位:秒), 必须是1s的整数倍
@@ -136,12 +136,12 @@ def audio_split_pydub(source_path, target_path, sr, channel_num, duration, endwi
136
136
  raise ImportError("需要安装 pydub 才能使用 audio_split_pydub: pip install pydub") from e
137
137
 
138
138
  assert duration % 1 == 0, "duration必须是1s的整数倍"
139
- wav_path_list = get_path_list(source_path, end=endwith) # 获取音频文件列表
139
+ wav_path_list = get_path_list(source_dir, end=endwith) # 获取音频文件列表
140
140
  print("待分割的音频数: ", len(wav_path_list))
141
141
 
142
142
  for wav_path in wav_path_list:
143
143
  print("正在分割: ", wav_path)
144
- wav_folder = wav_path[:-4].replace(source_path, target_path) # 设置目标文件夹
144
+ wav_folder = wav_path[:-4].replace(source_dir, target_dir) # 设置目标文件夹
145
145
  os.makedirs(wav_folder, exist_ok=True)
146
146
 
147
147
  # 使用pydub加载音频
@@ -1,43 +1,17 @@
1
- # -*- coding:utf-8 -*-
2
- # Author:凌逆战 | Never
3
- # Date: 2024/2/13
4
- """
1
+ '''
2
+ Author: 凌逆战 | Never
3
+ Date: 2025-09-24 14:28:42
4
+ Description:
5
5
  检查GPU时候空闲
6
6
  nohup python -u ./checkGPU.py > ./checkGPU.log 2>&1 &
7
7
  pid 5993
8
- """
8
+ '''
9
9
  import time
10
10
  import subprocess
11
11
  import numpy as np
12
12
  from .message import send_QQEmail
13
13
 
14
14
 
15
- def is_gpu_idle():
16
- try:
17
- import GPUtil
18
- except ImportError:
19
- raise ImportError(
20
- "GPUtil is required for is_gpu_idle(). "
21
- "Please install it via `pip install checkGPU`."
22
- )
23
- try:
24
- # 获取所有可见的GPU设备列表
25
- gpus = GPUtil.getGPUs()
26
- # print(len(gpus), gpus)
27
- gpu0, gpu1, gpu2, gpu3, gpu4, gpu5, gpu6, gpu7 = gpus # 8块GPU
28
- # gpu.memoryUtil表示GPU的内存利用率
29
- # gpu.load表示GPU的计算利用率
30
- # gpu.memoryTotal表示GPU的总内存
31
- # gpu.memoryUsed表示GPU的已使用内存
32
- # gpu.memoryFree表示GPU的空闲内存
33
- if gpu0.load == 0.0 and gpu1 == 0.0 and gpu2 == 0.0 and gpu3 == 0.0:
34
- return True
35
- return False
36
- except Exception as e:
37
- print(f"Error checking GPU utilization: {e}")
38
- return False
39
-
40
-
41
15
  def get_gpu_utilization():
42
16
  """
43
17
  Returns: 返回所有GPU利用率列表
@@ -53,9 +27,31 @@ def get_gpu_utilization():
53
27
  return None
54
28
 
55
29
 
30
+ def get_gpu_utilization2(gpu_id=None):
31
+ try:
32
+ import GPUtil
33
+ except ImportError:
34
+ raise ImportError(
35
+ "GPUtil is required for is_gpu_idle(). "
36
+ "Please install it via `pip install gputil`."
37
+ )
38
+ gpus = GPUtil.getGPUs() # 获取所有可见的GPU设备列表
39
+ # gpu.memoryUtil表示GPU的内存利用率
40
+ # gpu.load表示GPU的计算利用率
41
+ # gpu.memoryTotal表示GPU的总内存
42
+ # gpu.memoryUsed表示GPU的已使用内存
43
+ # gpu.memoryFree表示GPU的空闲内存
44
+ # 返回所有显卡的利用率列表
45
+ gpu_utilization = np.array([gpu.load * 100 for gpu in gpus])
46
+ if gpu_id is not None:
47
+ return gpu_utilization[gpu_id]
48
+ return gpu_utilization
49
+
50
+
56
51
  # 监控显卡利用率
57
- def monitor_gpu_utilization(check_interval=5, duration_limit=300, threshold=20,
58
- MonitorGPUs=[0, 1, 2, 3, 4, 5, 6, 7],
52
+ def monitor_gpu_utilization(check_interval=600, duration_limit=1800, threshold=20,
53
+ MonitorGPUs=None,
54
+ from_name="凌逆战",
59
55
  from_email="xxxxx@qq.com",
60
56
  from_password="xxxxxxx",
61
57
  to_email="xxxxx@qq.com"):
@@ -65,58 +61,35 @@ def monitor_gpu_utilization(check_interval=5, duration_limit=300, threshold=20,
65
61
  threshold = 20 # 利用率阈值
66
62
  Returns:
67
63
  """
68
- alarm_times = 0 # 报警次数
69
- max_alarm_times_1day = 10 # 24小时内最大报警次数
70
-
71
- timer_start = time.time()
72
- last_alarm_time = 0
73
- host_ip = subprocess.check_output(['hostname', '-I']).decode('utf-8').split()[0]
74
- print(f"Host IP: {host_ip}")
64
+ host_ip = subprocess.check_output(['hostname', '-I']).decode('utf-8').split()[0] # 172.16.64.33
75
65
 
76
66
  while True:
77
- utilization_mean = []
78
- for i in range(duration_limit // check_interval):
79
- utilization = get_gpu_utilization()
80
- if utilization is None:
81
- continue
67
+ utilization_mean = [] # 平均利用率
68
+ for i in range(duration_limit // check_interval): # 30分钟平均一次,每10分钟检查一次
69
+ utilization = get_gpu_utilization2(MonitorGPUs)
82
70
  utilization = np.array(utilization)
83
71
  utilization_mean.append(utilization)
84
- time.sleep(check_interval) # 每隔5秒检查一次
85
-
86
- utilization_mean = np.mean(np.array(utilization_mean), axis=0)
72
+ time.sleep(check_interval) # 每隔check_interval分钟检查一次
73
+ utilization_mean = np.mean(utilization_mean, axis=0)
87
74
  t_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
88
- print(f"T:{t_now} GPU Utilization: {utilization}")
89
-
90
- if utilization_mean is not None:
91
- alarm_flag = False
92
- for gpu_id in MonitorGPUs:
93
- if utilization_mean[gpu_id] < threshold:
94
- alarm_flag = True
95
- break
75
+ print(f"{t_now} GPU Utilization: {utilization}") # [95. 50. 91. 83. 84. 65. 95. 82.]
96
76
 
97
- if alarm_flag and alarm_times < max_alarm_times_1day:
98
- t_now = time.time()
99
- if t_now - last_alarm_time > 3600.0:
100
- send_QQEmail(title=f"GPU利用率警告",
101
- content=f"GPU 利用率低于 {threshold}% 在 {duration_limit} 秒内. "
102
- f"host ip: {host_ip}, 当前GPU利用率为:{utilization_mean}.",
103
- from_email=from_email,
104
- from_password=from_password,
105
- to_email=to_email)
106
-
107
- alarm_times += 1
108
- last_alarm_time = time.time()
109
- # clean max_alarm_times_1day if 24 hours passed
110
- if time.time() - timer_start > 24 * 3600.0:
111
- alarm_times = 0
112
- timer_start = time.time()
77
+ # 如果有GPU利用率低于阈值,则发送邮件
78
+ if np.any(utilization_mean < threshold):
79
+ send_QQEmail(title=f"GPU利用率警告",
80
+ content=f"服务器: {host_ip}\n {t_now} GPU利用率为:{utilization}. 低于阈值 {threshold}% \n",
81
+ from_name=from_name,
82
+ from_email=from_email,
83
+ from_password=from_password,
84
+ to_email=to_email)
85
+ print(f"Alarm sent: GPU utilization below {threshold}% for GPU(s) {utilization_mean}")
113
86
 
114
87
 
115
88
  if __name__ == "__main__":
116
- while True:
117
- if is_gpu_idle():
118
- send_QQEmail("GPU", "GPU 处于空闲状态.")
119
- else:
120
- print("GPU 处于繁忙状态.")
121
- # 休眠半个小时(1800秒)
122
- time.sleep(30 * 60)
89
+ # print(get_gpu_utilization2(gpu_id=3))
90
+ monitor_gpu_utilization(check_interval=1, duration_limit=3, threshold=100,
91
+ MonitorGPUs=[4, 5, 6, 7],
92
+ from_name="xxx",
93
+ from_email="xxxxxx@qq.com",
94
+ from_password="xxxxxxx",
95
+ to_email="xxxxxx@qq.com", )
@@ -0,0 +1,115 @@
1
+ '''
2
+ Author: 凌逆战 | Never
3
+ Date: 2025-03-26 22:13:21
4
+ Description: 路径层级互换(支持 Windows / Linux / macOS)
5
+ '''
6
+
7
+ import os
8
+ import shutil
9
+ from pathlib import Path
10
+ from neverlib.utils import get_path_list
11
+
12
+
13
+ def get_leaf_folders(directory):
14
+ # 获取最底层的文件夹路径
15
+ leaf_folders = []
16
+ for root, dirs, _ in os.walk(directory):
17
+ if not dirs: # 如果当前文件夹没有子文件夹
18
+ leaf_folders.append(root)
19
+ return leaf_folders
20
+
21
+
22
+ def rename_files_and_folders(directory, replace='_-', replacement='_'):
23
+ # 将路径的指定字符替换为指定字符
24
+ for root, dirs, files in os.walk(directory):
25
+ for filename in files:
26
+ if replace in filename:
27
+ new_filename = filename.replace(replace, replacement)
28
+ old_path = os.path.join(root, filename)
29
+ new_path = os.path.join(root, new_filename)
30
+ os.rename(old_path, new_path)
31
+ print(f'Renamed file: {old_path} -> {new_path}')
32
+
33
+ for folder in dirs:
34
+ if replace in folder:
35
+ new_folder = folder.replace(replace, replacement)
36
+ old_path = os.path.join(root, folder)
37
+ new_path = os.path.join(root, new_folder)
38
+ os.rename(old_path, new_path)
39
+ print(f'Renamed folder: {old_path} -> {new_path}')
40
+
41
+
42
+ def del_empty_folders(path):
43
+ """递归删除空文件夹(先删除子文件夹, 再删除父文件夹)"""
44
+ if not os.path.isdir(path):
45
+ return
46
+
47
+ # 获取子文件夹
48
+ subfolders = [
49
+ os.path.join(path, d) for d in os.listdir(path)
50
+ if os.path.isdir(os.path.join(path, d))
51
+ ]
52
+
53
+ # 递归处理子文件夹
54
+ for subfolder in subfolders:
55
+ del_empty_folders(subfolder)
56
+
57
+ # 如果文件夹为空,则删除
58
+ if not os.listdir(path):
59
+ os.rmdir(path)
60
+ print(f"删除空文件夹: {path}")
61
+
62
+
63
+ def change_path(source_dir, idx_1, idx_2):
64
+ # 统一路径类型
65
+ source_dir = Path(source_dir)
66
+ path_list = [Path(p) for p in get_path_list(str(source_dir), end="*.*")]
67
+
68
+ print("\n📂 文件路径变更预览(前 5 个):\n")
69
+ preview_count = min(5, len(path_list))
70
+
71
+ for i in range(preview_count):
72
+ path = path_list[i]
73
+ parts = list(path.parts) # 各层级组成的元组
74
+ try:
75
+ # 交换指定索引层级
76
+ parts[idx_1], parts[idx_2] = parts[idx_2], parts[idx_1]
77
+ except IndexError:
78
+ print(f"[警告] 索引越界:文件 {path}")
79
+ continue
80
+
81
+ new_path = Path(*parts)
82
+ print(f"原路径: {path}")
83
+ print(f"新路径: {new_path}\n")
84
+
85
+ # 交互确认
86
+ user_input = input("是否确认对所有文件进行以上变更? (y/n): ").strip().lower()
87
+ if user_input != "y":
88
+ print("❌ 操作已取消。")
89
+ return
90
+
91
+ print("\n🚀 开始批量处理文件...")
92
+ for path in path_list:
93
+ parts = list(path.parts)
94
+ try:
95
+ parts[idx_1], parts[idx_2] = parts[idx_2], parts[idx_1]
96
+ except IndexError:
97
+ print(f"[跳过] 索引错误:{path}")
98
+ continue
99
+
100
+ new_path = Path(*parts)
101
+ new_path.parent.mkdir(parents=True, exist_ok=True)
102
+ try:
103
+ shutil.move(str(path), str(new_path))
104
+ except Exception as e:
105
+ print(f"[错误] 无法移动 {path} -> {new_path}: {e}")
106
+
107
+ print("\n✅ 所有文件处理完成!")
108
+ del_empty_folders(str(source_dir)) # 清理空文件夹
109
+ print("🧹 已清空空目录。")
110
+
111
+
112
+ if __name__ == "__main__":
113
+ # 示例路径(自动根据系统适配)
114
+ source_dir = Path("/data01/never/Dataset/kws_data/Command_Word_NN_wrong_high/Crowdsourcing_wash/zh_kws/train/RealPerson")
115
+ change_path(source_dir, 10, 11)
neverlib/utils/pcm.py ADDED
@@ -0,0 +1,42 @@
1
+
2
+ import numpy as np
3
+ import soundfile as sf
4
+
5
+
6
+ def pcm2wav(pcm_path, wav_path, sr=16000, channels=1, subtype='PCM_16'):
7
+ """
8
+ 将pcm文件转换为wav文件
9
+ :param pcm_path: pcm文件路径
10
+ :param wav_path: wav文件路径
11
+ :param sr: 采样率
12
+ :param channels: 声道数
13
+ :param subtype: 子类型
14
+ """
15
+ pcm_data = np.fromfile(pcm_path, dtype=np.int16)
16
+ pcm_data = pcm_data.reshape(-1, channels) # 支持多通道
17
+ sf.write(wav_path, pcm_data, sr, subtype=subtype)
18
+
19
+
20
+ def wav2pcm(wav_path, pcm_path):
21
+ """
22
+ 将wav文件转换为pcm文件
23
+ :param wav_path: wav文件路径
24
+ :param pcm_path: pcm文件路径
25
+ """
26
+ data, _ = sf.read(wav_path, dtype='int16')
27
+ data.tofile(pcm_path)
28
+
29
+
30
+ def read_pcm(file_path, channels=5, sample_rate=16000, sample_width=2):
31
+ # Read raw binary data from the PCM file
32
+ with open(file_path, 'rb') as f:
33
+ raw_data = f.read()
34
+
35
+ # Convert binary data to numpy array of the correct dtype
36
+ audio_data = np.frombuffer(raw_data, dtype=np.int16)
37
+
38
+ # Reshape the data into a 2D array with shape (num_frames, channels)
39
+ num_frames = len(audio_data) // channels
40
+ audio_data = audio_data.reshape((num_frames, channels))
41
+
42
+ return audio_data
neverlib/utils/utils.py CHANGED
@@ -16,14 +16,14 @@ import numpy as np
16
16
  EPS = np.finfo(float).eps
17
17
 
18
18
 
19
- def get_path_list(source_path, end="*.wav", shuffle=False):
19
+ def get_path_list(source_dir, end="*.wav", shuffle=False):
20
20
  wav_list = []
21
- for root, dirnames, filenames in os.walk(source_path):
21
+ for root, dirnames, filenames in os.walk(source_dir):
22
22
  # 实现列表特殊字符的过滤或筛选,返回符合匹配“.wav”字符列表
23
23
  for filename in fnmatch.filter(filenames, end):
24
24
  wav_list.append(os.path.join(root, filename))
25
25
  if os.environ.get("LOCAL_RANK", "0") == "0":
26
- print(source_path, len(wav_list))
26
+ print(source_dir, len(wav_list))
27
27
  if shuffle:
28
28
  random.shuffle(wav_list)
29
29
  return wav_list
@@ -63,26 +63,6 @@ def get_audio_segments(sentence_len,
63
63
  return wav
64
64
 
65
65
 
66
- def rename_files_and_folders(directory, replace='_-', replacement='_'):
67
- # 将路径的指定字符替换为指定字符
68
- for root, dirs, files in os.walk(directory):
69
- for filename in files:
70
- if replace in filename:
71
- new_filename = filename.replace(replace, replacement)
72
- old_path = os.path.join(root, filename)
73
- new_path = os.path.join(root, new_filename)
74
- os.rename(old_path, new_path)
75
- print(f'Renamed file: {old_path} -> {new_path}')
76
-
77
- for folder in dirs:
78
- if replace in folder:
79
- new_folder = folder.replace(replace, replacement)
80
- old_path = os.path.join(root, folder)
81
- new_path = os.path.join(root, new_folder)
82
- os.rename(old_path, new_path)
83
- print(f'Renamed folder: {old_path} -> {new_path}')
84
-
85
-
86
66
  def get_file_time(file_path):
87
67
  # 获取最后修改时间
88
68
  mod_time = os.path.getmtime(file_path)
@@ -174,36 +154,6 @@ def TrainValTestSplit(dataset_dir,
174
154
  )
175
155
 
176
156
 
177
- def get_leaf_folders(directory):
178
- # 获取最底层的文件夹路径
179
- leaf_folders = []
180
- for root, dirs, _ in os.walk(directory):
181
- if not dirs: # 如果当前文件夹没有子文件夹
182
- leaf_folders.append(root)
183
- return leaf_folders
184
-
185
-
186
- def del_empty_folders(path):
187
- """递归删除空文件夹(先删除子文件夹, 再删除父文件夹)"""
188
- if not os.path.isdir(path):
189
- return
190
-
191
- # 获取子文件夹
192
- subfolders = [
193
- os.path.join(path, d) for d in os.listdir(path)
194
- if os.path.isdir(os.path.join(path, d))
195
- ]
196
-
197
- # 递归处理子文件夹
198
- for subfolder in subfolders:
199
- del_empty_folders(subfolder)
200
-
201
- # 如果文件夹为空,则删除
202
- if not os.listdir(path):
203
- os.rmdir(path)
204
- print(f"删除空文件夹: {path}")
205
-
206
-
207
157
  def DatasetSubfloderSplit(source_dir, split_dirs, percentage=None):
208
158
  """
209
159
  将一个数据集按照子文件夹数量分割成train/val/test数据集
@@ -282,30 +232,6 @@ def DatasetSubfloderSplit(source_dir, split_dirs, percentage=None):
282
232
  print(f"{split_name.capitalize()} folders: {len(folders)}")
283
233
 
284
234
 
285
- def pcm2wav(pcm_path, wav_path, sr=16000, channels=1, subtype='PCM_16'):
286
- """
287
- 将pcm文件转换为wav文件
288
- :param pcm_path: pcm文件路径
289
- :param wav_path: wav文件路径
290
- :param sr: 采样率
291
- :param channels: 声道数
292
- :param subtype: 子类型
293
- """
294
- pcm_data = np.fromfile(pcm_path, dtype=np.int16)
295
- pcm_data = pcm_data.reshape(-1, channels) # 支持多通道
296
- sf.write(wav_path, pcm_data, sr, subtype=subtype)
297
-
298
-
299
- def wav2pcm(wav_path, pcm_path):
300
- """
301
- 将wav文件转换为pcm文件
302
- :param wav_path: wav文件路径
303
- :param pcm_path: pcm文件路径
304
- """
305
- data, _ = sf.read(wav_path, dtype='int16')
306
- data.tofile(pcm_path)
307
-
308
-
309
235
  def save_weight_histogram(model,
310
236
  save_dir,
311
237
  mode=["params", "buffers"],
@@ -385,18 +311,3 @@ def save_weight_histogram(model,
385
311
  plt.hist(buffer, bins=bins)
386
312
  plt.savefig(os.path.join(save_dir, "buffer", f"{name}.png"))
387
313
  plt.close()
388
-
389
-
390
- def read_pcm(file_path, channels=5, sample_rate=16000, sample_width=2):
391
- # Read raw binary data from the PCM file
392
- with open(file_path, 'rb') as f:
393
- raw_data = f.read()
394
-
395
- # Convert binary data to numpy array of the correct dtype
396
- audio_data = np.frombuffer(raw_data, dtype=np.int16)
397
-
398
- # Reshape the data into a 2D array with shape (num_frames, channels)
399
- num_frames = len(audio_data) // channels
400
- audio_data = audio_data.reshape((num_frames, channels))
401
-
402
- return audio_data
neverlib/vad/__init__.py CHANGED
@@ -1,23 +1,5 @@
1
1
  # This file is auto-generated. Do NOT edit manually.
2
2
  # Generated by neverlib.QA.gen_init
3
-
4
- from typing import TYPE_CHECKING, Any
5
-
6
- if TYPE_CHECKING:
7
- # 仅在类型检查时导入,提供IDE补全支持
8
- from .PreProcess import NS, NS_test, pre_emphasis
9
- from .VAD_Energy import EnergyVad_C
10
- from .VAD_Silero import Silero_VAD_C
11
- from .VAD_WebRTC import WebRTC_VAD_C
12
- from .VAD_funasr import FunASR_VAD_C
13
- from .VAD_statistics import Statistics_VAD
14
- from .VAD_vadlib import Vadlib_C
15
- from .VAD_whisper import Whisper_VAD_C
16
- from .class_get_speech import getSpeech
17
- from .class_vad import VADClass
18
- from .utils import from_vadArray_to_vadEndpoint, vad2nad, vad_smooth
19
-
20
- # 运行时使用懒加载
21
3
  from lazy_loader import attach
22
4
 
23
5
  __getattr__, __dir__, __all__ = attach(
@@ -49,23 +31,3 @@ __getattr__, __dir__, __all__ = attach(
49
31
  "utils": ['from_vadArray_to_vadEndpoint', 'vad2nad', 'vad_smooth'],
50
32
  }
51
33
  )
52
-
53
- # 显式声明 __all__ 以便 IDE 识别
54
- if TYPE_CHECKING:
55
- __all__ = [
56
- 'NS',
57
- 'NS_test',
58
- 'pre_emphasis',
59
- 'EnergyVad_C',
60
- 'Silero_VAD_C',
61
- 'WebRTC_VAD_C',
62
- 'FunASR_VAD_C',
63
- 'Statistics_VAD',
64
- 'Vadlib_C',
65
- 'Whisper_VAD_C',
66
- 'getSpeech',
67
- 'VADClass',
68
- 'from_vadArray_to_vadEndpoint',
69
- 'vad2nad',
70
- 'vad_smooth',
71
- ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neverlib
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: A successful sign for python setup
5
5
  Author-email: "Never.Ling" <1786088386@qq.com>
6
6
  License: MIT
@@ -47,6 +47,14 @@ Requires-Dist: neverlib[vad]; extra == "all"
47
47
  Requires-Dist: neverlib[gpu]; extra == "all"
48
48
  Dynamic: license-file
49
49
 
50
+ <!--
51
+ * @Author: never.ling never.ling@anker-in.com
52
+ * @Date: 2025-11-04 17:10:57
53
+ * @LastEditors: never.ling never.ling@anker-in.com
54
+ * @LastEditTime: 2025-12-15 11:47:03
55
+ * @FilePath: /neverlib/README.md
56
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
57
+ -->
50
58
  # NeverLib
51
59
 
52
60
  一个用于音频处理和VAD(语音活动检测)的Python工具库。
@@ -113,6 +121,12 @@ from neverlib import utils
113
121
  from neverlib.message import seed_QQEmail
114
122
  ```
115
123
 
124
+ ## TODO List
125
+ - [ ] 客观指标添加 [DNSMOSPro ](https://github.com/fcumlin/DNSMOSPro)
126
+ - [ ] github界面的自我介绍
127
+ - [ ] https://github.com/nathanhaigh/parallel-rsync
128
+
129
+
116
130
  ## 许可证
117
131
 
118
132
  本项目采用MIT许可证。详情请参阅LICENSE文件。