whispercpp 1.3.7 → 1.3.8

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 (308) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/ext/options.rb +1 -1
  4. data/ext/ruby_whisper.c +0 -1
  5. data/ext/ruby_whisper.h +7 -1
  6. data/ext/ruby_whisper_context.c +50 -1
  7. data/ext/ruby_whisper_log_settable.h +1 -2
  8. data/ext/ruby_whisper_params.c +9 -8
  9. data/ext/ruby_whisper_transcribe.cpp +0 -19
  10. data/ext/ruby_whisper_vad_context.c +30 -10
  11. data/ext/ruby_whisper_vad_context_detect.cpp +8 -9
  12. data/ext/ruby_whisper_vad_params.c +4 -4
  13. data/ext/ruby_whisper_vad_segment.c +2 -2
  14. data/ext/sources/CMakeLists.txt +2 -1
  15. data/ext/sources/cmake/parakeet.pc.in +2 -2
  16. data/ext/sources/cmake/whisper.pc.in +2 -2
  17. data/ext/sources/examples/cli/cli.cpp +9 -1
  18. data/ext/sources/examples/common-ggml.cpp +2 -0
  19. data/ext/sources/examples/vad-speech-segments/speech.cpp +3 -2
  20. data/ext/sources/ggml/CMakeLists.txt +3 -4
  21. data/ext/sources/ggml/include/ggml-cuda.h +0 -3
  22. data/ext/sources/ggml/include/ggml-sycl.h +8 -0
  23. data/ext/sources/ggml/include/ggml.h +3 -1
  24. data/ext/sources/ggml/src/CMakeLists.txt +8 -1
  25. data/ext/sources/ggml/src/ggml-backend-meta.cpp +7 -4
  26. data/ext/sources/ggml/src/ggml-common.h +13 -2
  27. data/ext/sources/ggml/src/ggml-cpu/CMakeLists.txt +1 -1
  28. data/ext/sources/ggml/src/ggml-cpu/amx/mmq.cpp +5 -6
  29. data/ext/sources/ggml/src/ggml-cpu/arch/arm/quants.c +78 -4
  30. data/ext/sources/ggml/src/ggml-cpu/arch/x86/quants.c +142 -4
  31. data/ext/sources/ggml/src/ggml-cpu/arch-fallback.h +7 -2
  32. data/ext/sources/ggml/src/ggml-cpu/ggml-cpu.c +14 -0
  33. data/ext/sources/ggml/src/ggml-cpu/llamafile/sgemm.cpp +26 -19
  34. data/ext/sources/ggml/src/ggml-cpu/ops.cpp +129 -46
  35. data/ext/sources/ggml/src/ggml-cpu/quants.c +51 -0
  36. data/ext/sources/ggml/src/ggml-cpu/quants.h +3 -0
  37. data/ext/sources/ggml/src/ggml-cpu/simd-gemm.h +1 -1
  38. data/ext/sources/ggml/src/ggml-cpu/simd-mappings.h +11 -0
  39. data/ext/sources/ggml/src/ggml-cpu/vec.cpp +2 -2
  40. data/ext/sources/ggml/src/ggml-cuda/binbcast.cu +90 -46
  41. data/ext/sources/ggml/src/ggml-cuda/col2im-1d.cu +81 -0
  42. data/ext/sources/ggml/src/ggml-cuda/col2im-1d.cuh +3 -0
  43. data/ext/sources/ggml/src/ggml-cuda/common.cuh +4 -0
  44. data/ext/sources/ggml/src/ggml-cuda/concat.cu +33 -21
  45. data/ext/sources/ggml/src/ggml-cuda/conv-transpose-1d.cu +14 -12
  46. data/ext/sources/ggml/src/ggml-cuda/convert.cu +86 -34
  47. data/ext/sources/ggml/src/ggml-cuda/cpy.cu +80 -29
  48. data/ext/sources/ggml/src/ggml-cuda/fattn-common.cuh +9 -5
  49. data/ext/sources/ggml/src/ggml-cuda/fattn-mma-f16.cuh +4 -0
  50. data/ext/sources/ggml/src/ggml-cuda/fattn-tile.cuh +9 -5
  51. data/ext/sources/ggml/src/ggml-cuda/fattn.cu +27 -21
  52. data/ext/sources/ggml/src/ggml-cuda/gated_delta_net.cu +40 -25
  53. data/ext/sources/ggml/src/ggml-cuda/gated_delta_net.cuh +10 -0
  54. data/ext/sources/ggml/src/ggml-cuda/getrows.cu +15 -12
  55. data/ext/sources/ggml/src/ggml-cuda/ggml-cuda.cu +718 -1248
  56. data/ext/sources/ggml/src/ggml-cuda/mmq.cu +7 -0
  57. data/ext/sources/ggml/src/ggml-cuda/mmvq.cu +77 -40
  58. data/ext/sources/ggml/src/ggml-cuda/out-prod.cu +55 -12
  59. data/ext/sources/ggml/src/ggml-cuda/set-rows.cu +64 -4
  60. data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +1 -0
  61. data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +1 -0
  62. data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +1 -0
  63. data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +1 -0
  64. data/ext/sources/ggml/src/ggml-cuda/topk-moe.cu +7 -1
  65. data/ext/sources/ggml/src/ggml-cuda/vendors/hip.h +1 -0
  66. data/ext/sources/ggml/src/ggml-cuda/vendors/musa.h +1 -0
  67. data/ext/sources/ggml/src/ggml-hexagon/CMakeLists.txt +0 -5
  68. data/ext/sources/ggml/src/ggml-hexagon/ggml-hexagon.cpp +1634 -1293
  69. data/ext/sources/ggml/src/ggml-hexagon/htp/CMakeLists.txt +11 -40
  70. data/ext/sources/ggml/src/ggml-hexagon/htp/cmake-toolchain.cmake +13 -15
  71. data/ext/sources/ggml/src/ggml-hexagon/htp/concat-ops.c +1 -1
  72. data/ext/sources/ggml/src/ggml-hexagon/htp/flash-attn-ops.c +1749 -399
  73. data/ext/sources/ggml/src/ggml-hexagon/htp/flash-attn-ops.h +303 -0
  74. data/ext/sources/ggml/src/ggml-hexagon/htp/hex-common.h +80 -0
  75. data/ext/sources/ggml/src/ggml-hexagon/htp/hex-dma.h +26 -23
  76. data/ext/sources/ggml/src/ggml-hexagon/htp/hex-profile.h +64 -0
  77. data/ext/sources/ggml/src/ggml-hexagon/htp/hex-utils.h +1 -83
  78. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-fa-kernels.h +555 -0
  79. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-mm-kernels-tiled.h +1303 -0
  80. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-queue.c +9 -0
  81. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-queue.h +27 -4
  82. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-utils.h +59 -37
  83. data/ext/sources/ggml/src/ggml-hexagon/htp/htp-ctx.h +11 -3
  84. data/ext/sources/ggml/src/ggml-hexagon/htp/htp-ops.h +52 -12
  85. data/ext/sources/ggml/src/ggml-hexagon/htp/htp-vtcm.h +19 -0
  86. data/ext/sources/ggml/src/ggml-hexagon/htp/htp_iface.idl +2 -1
  87. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-base.h +14 -30
  88. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-exp.h +39 -0
  89. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-fa-kernels.h +232 -0
  90. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-flat.h +1511 -0
  91. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-tiled.h +1200 -0
  92. data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-sigmoid.h +39 -0
  93. data/ext/sources/ggml/src/ggml-hexagon/htp/main.c +127 -32
  94. data/ext/sources/ggml/src/ggml-hexagon/htp/matmul-ops.c +3023 -4425
  95. data/ext/sources/ggml/src/ggml-hexagon/htp/matmul-ops.h +650 -0
  96. data/ext/sources/ggml/src/ggml-hexagon/htp/rope-ops.c +48 -13
  97. data/ext/sources/ggml/src/ggml-hexagon/htp/ssm-conv.c +10 -9
  98. data/ext/sources/ggml/src/ggml-hexagon/htp/worker-pool.c +15 -3
  99. data/ext/sources/ggml/src/ggml-hexagon/htp/worker-pool.h +8 -0
  100. data/ext/sources/ggml/src/ggml-hexagon/htp-opnode.h +168 -50
  101. data/ext/sources/ggml/src/ggml-hexagon/libggml-htp.inf +0 -4
  102. data/ext/sources/ggml/src/ggml-hip/CMakeLists.txt +5 -0
  103. data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.cpp +69 -5
  104. data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.h +4 -1
  105. data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.m +27 -6
  106. data/ext/sources/ggml/src/ggml-metal/ggml-metal-impl.h +38 -0
  107. data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.cpp +132 -2
  108. data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.h +2 -0
  109. data/ext/sources/ggml/src/ggml-metal/ggml-metal.metal +345 -87
  110. data/ext/sources/ggml/src/ggml-opencl/CMakeLists.txt +13 -0
  111. data/ext/sources/ggml/src/ggml-opencl/fa_tune.h +92 -0
  112. data/ext/sources/ggml/src/ggml-opencl/ggml-opencl.cpp +4060 -357
  113. data/ext/sources/ggml/src/ggml-opencl/kernels/cvt.cl +198 -0
  114. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f16.cl +81 -41
  115. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32.cl +88 -39
  116. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_f16.cl +1995 -96
  117. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_q4_0.cl +1615 -0
  118. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_q8_0.cl +1486 -0
  119. data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_pre_f16.cl +156 -0
  120. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32_ns.cl +74 -6
  121. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_0_f32_ns.cl +74 -6
  122. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_1_f32_ns.cl +74 -6
  123. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_k_f32_ns.cl +71 -6
  124. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_0_f32_ns.cl +74 -6
  125. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_1_f32_ns.cl +74 -6
  126. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_k_f32_ns.cl +74 -6
  127. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q6_k_f32_ns.cl +74 -6
  128. data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q1_0_f32.cl +94 -0
  129. data/ext/sources/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q1_0_f32.cl +121 -0
  130. data/ext/sources/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q8_0_f32.cl +1 -1
  131. data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mm_q1_0_f32_l4_lm.cl +156 -0
  132. data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl +1149 -0
  133. data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32.cl +141 -0
  134. data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32_flat.cl +190 -0
  135. data/ext/sources/ggml/src/ggml-opencl/kernels/norm.cl +5 -2
  136. data/ext/sources/ggml/src/ggml-opencl/kernels/set_rows.cl +500 -0
  137. data/ext/sources/ggml/src/ggml-opencl/libdl.h +79 -0
  138. data/ext/sources/ggml/src/ggml-openvino/.clang-format +0 -5
  139. data/ext/sources/ggml/src/ggml-openvino/CMakeLists.txt +2 -4
  140. data/ext/sources/ggml/src/ggml-openvino/ggml-decoder.cpp +733 -130
  141. data/ext/sources/ggml/src/ggml-openvino/ggml-decoder.h +76 -23
  142. data/ext/sources/ggml/src/ggml-openvino/ggml-openvino-extra.cpp +57 -3
  143. data/ext/sources/ggml/src/ggml-openvino/ggml-openvino-extra.h +29 -8
  144. data/ext/sources/ggml/src/ggml-openvino/ggml-openvino.cpp +307 -59
  145. data/ext/sources/ggml/src/ggml-openvino/ggml-quants.cpp +66 -0
  146. data/ext/sources/ggml/src/ggml-openvino/ggml-quants.h +10 -4
  147. data/ext/sources/ggml/src/ggml-openvino/openvino/decoder.h +56 -16
  148. data/ext/sources/ggml/src/ggml-openvino/openvino/frontend.h +1 -1
  149. data/ext/sources/ggml/src/ggml-openvino/openvino/input_model.h +4 -4
  150. data/ext/sources/ggml/src/ggml-openvino/openvino/node_context.h +94 -37
  151. data/ext/sources/ggml/src/ggml-openvino/openvino/op/add_id.cpp +76 -0
  152. data/ext/sources/ggml/src/ggml-openvino/openvino/op/argsort.cpp +47 -0
  153. data/ext/sources/ggml/src/ggml-openvino/openvino/op/clamp.cpp +33 -0
  154. data/ext/sources/ggml/src/ggml-openvino/openvino/op/concat.cpp +48 -0
  155. data/ext/sources/ggml/src/ggml-openvino/openvino/op/cont.cpp +8 -16
  156. data/ext/sources/ggml/src/ggml-openvino/openvino/op/cpy.cpp +14 -1
  157. data/ext/sources/ggml/src/ggml-openvino/openvino/op/div.cpp +146 -0
  158. data/ext/sources/ggml/src/ggml-openvino/openvino/op/flash_attn_ext.cpp +108 -21
  159. data/ext/sources/ggml/src/ggml-openvino/openvino/op/gated_delta_net.cpp +282 -0
  160. data/ext/sources/ggml/src/ggml-openvino/openvino/op/gated_delta_net.hpp +65 -0
  161. data/ext/sources/ggml/src/ggml-openvino/openvino/op/get_rows.cpp +2 -9
  162. data/ext/sources/ggml/src/ggml-openvino/openvino/op/glu_geglu.cpp +21 -7
  163. data/ext/sources/ggml/src/ggml-openvino/openvino/op/glu_swiglu.cpp +41 -8
  164. data/ext/sources/ggml/src/ggml-openvino/openvino/op/im2col.cpp +120 -0
  165. data/ext/sources/ggml/src/ggml-openvino/openvino/op/l2_norm.cpp +44 -0
  166. data/ext/sources/ggml/src/ggml-openvino/openvino/op/mul_mat_id.cpp +226 -0
  167. data/ext/sources/ggml/src/ggml-openvino/openvino/op/mulmat.cpp +19 -9
  168. data/ext/sources/ggml/src/ggml-openvino/openvino/op/norm.cpp +58 -0
  169. data/ext/sources/ggml/src/ggml-openvino/openvino/op/pad.cpp +95 -0
  170. data/ext/sources/ggml/src/ggml-openvino/openvino/op/permute.cpp +58 -13
  171. data/ext/sources/ggml/src/ggml-openvino/openvino/op/repeat.cpp +74 -0
  172. data/ext/sources/ggml/src/ggml-openvino/openvino/op/reshape.cpp +13 -6
  173. data/ext/sources/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp +1 -1
  174. data/ext/sources/ggml/src/ggml-openvino/openvino/op/rope.cpp +134 -38
  175. data/ext/sources/ggml/src/ggml-openvino/openvino/op/set_rows.cpp +3 -3
  176. data/ext/sources/ggml/src/ggml-openvino/openvino/op/softmax.cpp +126 -49
  177. data/ext/sources/ggml/src/ggml-openvino/openvino/op/ssm_conv.cpp +59 -0
  178. data/ext/sources/ggml/src/ggml-openvino/openvino/op/sum_rows.cpp +27 -0
  179. data/ext/sources/ggml/src/ggml-openvino/openvino/op/transpose.cpp +32 -1
  180. data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_silu.cpp +1 -1
  181. data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_softplus.cpp +38 -0
  182. data/ext/sources/ggml/src/ggml-openvino/openvino/op/view.cpp +90 -25
  183. data/ext/sources/ggml/src/ggml-openvino/openvino/op_table.cpp +41 -23
  184. data/ext/sources/ggml/src/ggml-openvino/openvino/op_table.h +18 -5
  185. data/ext/sources/ggml/src/ggml-openvino/openvino/pass/mark_decompression_convert_constant_folding.h +1 -1
  186. data/ext/sources/ggml/src/ggml-openvino/openvino/translate_session.cpp +43 -40
  187. data/ext/sources/ggml/src/ggml-openvino/openvino/translate_session.h +5 -4
  188. data/ext/sources/ggml/src/ggml-openvino/openvino/utils.cpp +548 -3
  189. data/ext/sources/ggml/src/ggml-openvino/openvino/utils.h +28 -26
  190. data/ext/sources/ggml/src/ggml-openvino/utils.cpp +383 -94
  191. data/ext/sources/ggml/src/ggml-openvino/utils.h +11 -8
  192. data/ext/sources/ggml/src/ggml-quants.c +76 -0
  193. data/ext/sources/ggml/src/ggml-quants.h +3 -0
  194. data/ext/sources/ggml/src/ggml-sycl/CMakeLists.txt +5 -5
  195. data/ext/sources/ggml/src/ggml-sycl/backend.hpp +2 -0
  196. data/ext/sources/ggml/src/ggml-sycl/binbcast.cpp +12 -0
  197. data/ext/sources/ggml/src/ggml-sycl/col2im-1d.cpp +102 -0
  198. data/ext/sources/ggml/src/ggml-sycl/col2im-1d.hpp +8 -0
  199. data/ext/sources/ggml/src/ggml-sycl/common.cpp +6 -8
  200. data/ext/sources/ggml/src/ggml-sycl/common.hpp +19 -2
  201. data/ext/sources/ggml/src/ggml-sycl/concat.cpp +21 -1
  202. data/ext/sources/ggml/src/ggml-sycl/conv2d-dw.cpp +158 -0
  203. data/ext/sources/ggml/src/ggml-sycl/conv2d-dw.hpp +10 -0
  204. data/ext/sources/ggml/src/ggml-sycl/conv2d-transpose.cpp +125 -0
  205. data/ext/sources/ggml/src/ggml-sycl/conv2d-transpose.hpp +10 -0
  206. data/ext/sources/ggml/src/ggml-sycl/conv2d.cpp +150 -0
  207. data/ext/sources/ggml/src/ggml-sycl/conv2d.hpp +10 -0
  208. data/ext/sources/ggml/src/ggml-sycl/conv3d.cpp +224 -0
  209. data/ext/sources/ggml/src/ggml-sycl/conv3d.hpp +8 -0
  210. data/ext/sources/ggml/src/ggml-sycl/convert.cpp +6 -0
  211. data/ext/sources/ggml/src/ggml-sycl/cpy.cpp +706 -0
  212. data/ext/sources/ggml/src/ggml-sycl/cpy.hpp +281 -0
  213. data/ext/sources/ggml/src/ggml-sycl/cross_entropy_loss.cpp +255 -0
  214. data/ext/sources/ggml/src/ggml-sycl/cross_entropy_loss.hpp +7 -0
  215. data/ext/sources/ggml/src/ggml-sycl/dequantize.hpp +15 -0
  216. data/ext/sources/ggml/src/ggml-sycl/dmmv.cpp +492 -319
  217. data/ext/sources/ggml/src/ggml-sycl/dpct/helper.hpp +15 -7
  218. data/ext/sources/ggml/src/ggml-sycl/element_wise.cpp +215 -115
  219. data/ext/sources/ggml/src/ggml-sycl/element_wise.hpp +2 -0
  220. data/ext/sources/ggml/src/ggml-sycl/ggml-sycl.cpp +1006 -336
  221. data/ext/sources/ggml/src/ggml-sycl/mmvq.cpp +252 -67
  222. data/ext/sources/ggml/src/ggml-sycl/mmvq.hpp +17 -0
  223. data/ext/sources/ggml/src/ggml-sycl/norm.cpp +103 -49
  224. data/ext/sources/ggml/src/ggml-sycl/outprod.cpp +45 -9
  225. data/ext/sources/ggml/src/ggml-sycl/pool.cpp +185 -0
  226. data/ext/sources/ggml/src/ggml-sycl/pool.hpp +22 -0
  227. data/ext/sources/ggml/src/ggml-sycl/presets.hpp +3 -1
  228. data/ext/sources/ggml/src/ggml-sycl/set_rows.cpp +10 -2
  229. data/ext/sources/ggml/src/ggml-sycl/softmax.cpp +9 -10
  230. data/ext/sources/ggml/src/ggml-sycl/vecdotq.hpp +35 -0
  231. data/ext/sources/ggml/src/ggml-vulkan/CMakeLists.txt +5 -0
  232. data/ext/sources/ggml/src/ggml-vulkan/ggml-vulkan.cpp +833 -215
  233. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/col2im_1d.comp +61 -0
  234. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp +1 -1
  235. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/conv3d_mm.comp +431 -0
  236. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/diag.comp +3 -3
  237. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn.comp +1 -0
  238. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm1.comp +1 -0
  239. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/generic_unary_head.glsl +21 -19
  240. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_back.comp +25 -0
  241. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/glu_head.glsl +23 -4
  242. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/glu_main.glsl +14 -18
  243. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/l2_norm.comp +4 -7
  244. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq.comp +21 -24
  245. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp +31 -23
  246. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp +6 -5
  247. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_funcs.glsl +84 -67
  248. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/norm.comp +10 -10
  249. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/repeat_back.comp +3 -3
  250. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/roll.comp +3 -3
  251. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/tri.comp +3 -3
  252. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/unary.comp +168 -0
  253. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +121 -74
  254. data/ext/sources/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp +26 -19
  255. data/ext/sources/ggml/src/ggml-webgpu/ggml-webgpu.cpp +31 -36
  256. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/common_decls.tmpl +16 -2
  257. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_split.wgsl +7 -7
  258. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/get_rows.wgsl +21 -0
  259. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_decls.tmpl +439 -320
  260. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_vec.wgsl +2 -2
  261. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec.wgsl +45 -39
  262. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_acc.tmpl +586 -465
  263. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_q_acc.tmpl +63 -69
  264. data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/quantize_q8.wgsl +14 -9
  265. data/ext/sources/ggml/src/ggml.c +36 -14
  266. data/ext/sources/include/whisper.h +21 -0
  267. data/ext/sources/src/whisper.cpp +164 -14
  268. data/lib/whisper/log_settable.rb +5 -8
  269. data/lib/whisper/model/uri.rb +0 -7
  270. data/sig/whisper.rbs +6 -0
  271. data/test/test_vad.rb +9 -0
  272. data/test/test_vad_context.rb +2 -2
  273. data/whispercpp.gemspec +1 -1
  274. metadata +62 -37
  275. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-flash-attn-ops.c +0 -1878
  276. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-matmul-ops.c +0 -2066
  277. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-ops.c +0 -6
  278. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-ops.h +0 -88
  279. data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-profile.h +0 -34
  280. data/ext/sources/ggml/src/ggml-hexagon/htp/vtcm-utils.h +0 -16
  281. data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_gelu.cpp +0 -25
  282. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/abs.comp +0 -21
  283. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/ceil.comp +0 -22
  284. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/clamp.comp +0 -17
  285. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/cos.comp +0 -17
  286. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/elu.comp +0 -27
  287. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/exp.comp +0 -20
  288. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/floor.comp +0 -22
  289. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu.comp +0 -25
  290. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu_erf.comp +0 -39
  291. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu_quick.comp +0 -23
  292. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardsigmoid.comp +0 -22
  293. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardswish.comp +0 -22
  294. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/leaky_relu.comp +0 -22
  295. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/neg.comp +0 -20
  296. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/relu.comp +0 -21
  297. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/round.comp +0 -29
  298. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sgn.comp +0 -21
  299. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sigmoid.comp +0 -20
  300. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/silu.comp +0 -22
  301. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sin.comp +0 -17
  302. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/softplus.comp +0 -23
  303. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sqrt.comp +0 -17
  304. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/square.comp +0 -17
  305. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/step.comp +0 -22
  306. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp +0 -20
  307. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/trunc.comp +0 -22
  308. data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/xielu.comp +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 653ebeab03cd2a1649a8875b6f57c3f2d8e0882a8598b309fa3120786854bde3
4
- data.tar.gz: abab58ce120bfd629098f184859ce7ab10d021390f0e469adeb4f4ad38c7ba66
3
+ metadata.gz: 264b8094aa764edf57c6e11ded6d412f5f71e174031b7f6f3d331bcd42487920
4
+ data.tar.gz: c6f5b4eccab0ca11c4b5e87055e4149ef25c73b570cab57c70b54a03aba839e4
5
5
  SHA512:
6
- metadata.gz: f46de7f44669b0edfe454ee1f934ce817c38e96459d8557db3f21fbdcebd31b7e2f77f7447ea398cc7a4e173e5433d2f3114005bf38e749f12529942b8934392
7
- data.tar.gz: 4236987e5951e4317a84d61b50b0a312075d5714e473e2c726001a1a0b0f775f7e59743be63d3f19466a8d49847bbdc9ce74f1eb0c35c92ffd000cca7024034f
6
+ metadata.gz: b23056b8ab8bf49b5a72f8771dc91dba1b1bc128f1ddb7b1b6f0c09bc2545d4d65305576009bfc33fa92d9714acf116bb43b0e35b3c9750d7c107892d9a765c3
7
+ data.tar.gz: 675048319ec63d7c88b63e5919b4ad65808e8ff3d75b903e729b9385fae76759ca6014c57bedda988bd2e71d4a9027eb43cda5f439e9fdca0bc5b57fdfeecf7f
data/README.md CHANGED
@@ -117,7 +117,7 @@ Whisper::Params.new(
117
117
  threshold: 1.0, # defaults to 0.5
118
118
  min_speech_duration_ms: 500, # defaults to 250
119
119
  min_silence_duration_ms: 200, # defaults to 100
120
- max_speech_duration_s: 30000, # default is FLT_MAX,
120
+ max_speech_duration_s: 30000.0, # default is FLT_MAX,
121
121
  speech_pad_ms: 50, # defaults to 30
122
122
  samples_overlap: 0.5 # defaults to 0.1
123
123
  ),
@@ -176,7 +176,7 @@ See whisper.cpp's [README](https://github.com/ggml-org/whisper.cpp/blob/master/R
176
176
  Boolean options:
177
177
 
178
178
  * `-DGGML_BLAS=1` -> `--enable-ggml-blas`
179
- * `-DWHISER_COREML=OFF` -> `--disable-whisper-coreml`
179
+ * `-DWHISPER_COREML=OFF` -> `--disable-whisper-coreml`
180
180
 
181
181
  Argument options:
182
182
 
@@ -184,7 +184,7 @@ Argument options:
184
184
 
185
185
  Combination:
186
186
 
187
- * `-DGGML_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="86"` -> `--enable-ggml-cuda --cmake_cuda-architectures="86"`
187
+ * `-DGGML_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="86"` -> `--enable-ggml-cuda --cmake-cuda-architectures="86"`
188
188
 
189
189
  For boolean options like `GGML_CUDA`, the README says `-DGGML_CUDA=1`. You need strip `-D`, prepend `--enable-` for `1` or `ON` (`--disable-` for `0` or `OFF`) and make it kebab-case: `--enable-ggml-cuda`.
190
190
  For options which require arguments like `CMAKE_CUDA_ARCHITECTURES`, the README says `-DCMAKE_CUDA_ARCHITECTURES="86"`. You need strip `-D`, prepend `--`, make it kebab-case, append `=` and append argument: `--cmake-cuda-architectures="86"`.
@@ -478,13 +478,14 @@ Development
478
478
  % cd whisper.cpp/bindings/ruby
479
479
  % rake test
480
480
 
481
- First call of `rake test` builds an extension and downloads a model for testing. After that, you add tests in `tests` directory and modify `ext/ruby_whisper.cpp`.
481
+ First call of `rake test` builds an extension and downloads a model for testing. After that, you add tests in `test` directory and modify `ext/*.{h,c,cpp}`.
482
482
 
483
483
  If something seems wrong on build, running `rake clean` solves some cases.
484
484
 
485
485
  ### Need help ###
486
486
 
487
487
  * Windows support
488
+ * Check of compilation with various hardware
488
489
  * Refinement of C/C++ code, especially memory management
489
490
 
490
491
  License
data/ext/options.rb CHANGED
@@ -105,7 +105,7 @@ class Options
105
105
  FileUtils.mkpath File.dirname(cache_path)
106
106
  File.open cache_path, "w" do |file|
107
107
  @options.reject {|name, (type, value)| value.nil?}.each do |name, (type, value)|
108
- line = "set(CACHE{%<name>s} TYPE %<type>s FORCE VALUE %<value>s)" % {
108
+ line = 'set(%<name>s %<value>s CACHE %<type>s "" FORCE)' %{
109
109
  name:,
110
110
  type:,
111
111
  value: value == true ? "ON" : value == false ? "OFF" : escape_cmake(value)
data/ext/ruby_whisper.c CHANGED
@@ -133,7 +133,6 @@ void Init_whisper() {
133
133
  id_coreml_compiled_models = rb_intern("coreml_compiled_models");
134
134
  id_cache = rb_intern("cache");
135
135
  id_n_processors = rb_intern("n_processors");
136
- id_extended = rb_intern("extended");
137
136
  id_start_log_callback_thread = rb_intern("start_log_callback_thread");
138
137
  id_log_callback_thread = rb_intern("@log_callback_thread");
139
138
  id_alive_p = rb_intern("alive?");
data/ext/ruby_whisper.h CHANGED
@@ -110,6 +110,13 @@ typedef struct {
110
110
  int n_samples;
111
111
  } ruby_whisper_full_args;
112
112
 
113
+ typedef struct segments_from_samples_args {
114
+ VALUE *context;
115
+ VALUE *params;
116
+ float *samples;
117
+ int n_samples;
118
+ } segments_from_samples_args;
119
+
113
120
  typedef struct ruby_whisper_full_parallel_args {
114
121
  VALUE *context;
115
122
  VALUE *params;
@@ -149,7 +156,6 @@ typedef struct {
149
156
  VALUE context;
150
157
  } ruby_whisper_parakeet_model;
151
158
 
152
- extern ID id_extended;
153
159
  extern ID id_log_callback_thread;
154
160
  extern ID id_start_log_callback_thread;
155
161
  extern ID id_alive_p;
@@ -349,7 +349,11 @@ fill_samples(VALUE rb_args)
349
349
 
350
350
  if (RB_TYPE_P(*args->src, T_ARRAY)) {
351
351
  for (int i = 0; i < args->n_samples; i++) {
352
- args->dest[i] = RFLOAT_VALUE(rb_ary_entry(*args->src, i));
352
+ VALUE sample = rb_ary_entry(*args->src, i);
353
+ if (!RB_FLOAT_TYPE_P(sample)) {
354
+ sample = rb_to_float(sample);
355
+ }
356
+ args->dest[i] = RFLOAT_VALUE(sample);
353
357
  }
354
358
  } else {
355
359
  // TODO: use rb_block_call
@@ -357,6 +361,9 @@ fill_samples(VALUE rb_args)
357
361
  for (int i = 0; i < args->n_samples; i++) {
358
362
  // TODO: check if iter is exhausted and raise ArgumentError appropriately
359
363
  VALUE sample = rb_funcall(iter, id_next, 0);
364
+ if (!RB_FLOAT_TYPE_P(sample)) {
365
+ sample = rb_to_float(sample);
366
+ }
360
367
  args->dest[i] = RFLOAT_VALUE(sample);
361
368
  }
362
369
  }
@@ -745,6 +752,45 @@ ruby_whisper_full_get_segment_no_speech_prob(VALUE self, VALUE i_segment)
745
752
  return DBL2NUM(no_speech_prob);
746
753
  }
747
754
 
755
+ static VALUE
756
+ ruby_whisper_full_n_vad_segments(VALUE self)
757
+ {
758
+ ruby_whisper *rw;
759
+ GetContext(self, rw);
760
+
761
+ return INT2NUM(whisper_full_n_vad_segments(rw->context));
762
+ }
763
+
764
+ static int
765
+ ruby_whisper_full_check_vad_segment_index(const ruby_whisper *rw, const VALUE i_segment)
766
+ {
767
+ const int c_i_segment = NUM2INT(i_segment);
768
+ if (c_i_segment < 0 || c_i_segment >= whisper_full_n_vad_segments(rw->context)) {
769
+ rb_raise(rb_eIndexError, "segment index %d out of range", c_i_segment);
770
+ }
771
+ return c_i_segment;
772
+ }
773
+
774
+ static VALUE
775
+ ruby_whisper_full_get_vad_segment_t0(VALUE self, VALUE i_segment)
776
+ {
777
+ ruby_whisper *rw;
778
+ GetContext(self, rw);
779
+ const int c_i_segment = ruby_whisper_full_check_vad_segment_index(rw, i_segment);
780
+
781
+ return LONG2NUM(whisper_full_get_vad_segment_t0(rw->context, c_i_segment));
782
+ }
783
+
784
+ static VALUE
785
+ ruby_whisper_full_get_vad_segment_t1(VALUE self, VALUE i_segment)
786
+ {
787
+ ruby_whisper *rw;
788
+ GetContext(self, rw);
789
+ const int c_i_segment = ruby_whisper_full_check_vad_segment_index(rw, i_segment);
790
+
791
+ return LONG2NUM(whisper_full_get_vad_segment_t1(rw->context, c_i_segment));
792
+ }
793
+
748
794
  // High level API
749
795
 
750
796
  static VALUE
@@ -830,6 +876,9 @@ init_ruby_whisper_context(VALUE *mWhisper)
830
876
  rb_define_method(cContext, "full_get_segment_speaker_turn_next", ruby_whisper_full_get_segment_speaker_turn_next, 1);
831
877
  rb_define_method(cContext, "full_get_segment_text", ruby_whisper_full_get_segment_text, 1);
832
878
  rb_define_method(cContext, "full_get_segment_no_speech_prob", ruby_whisper_full_get_segment_no_speech_prob, 1);
879
+ rb_define_method(cContext, "full_n_vad_segments", ruby_whisper_full_n_vad_segments, 0);
880
+ rb_define_method(cContext, "full_get_vad_segment_t0", ruby_whisper_full_get_vad_segment_t0, 1);
881
+ rb_define_method(cContext, "full_get_vad_segment_t1", ruby_whisper_full_get_vad_segment_t1, 1);
833
882
  rb_define_method(cContext, "full", ruby_whisper_full, -1);
834
883
  rb_define_method(cContext, "full_parallel", ruby_whisper_full_parallel, -1);
835
884
 
@@ -41,7 +41,6 @@
41
41
  rb_define_singleton_method(mod, "drain_logs", ruby_whisper_##log_queue##_s_drain_logs, 0); \
42
42
  rb_define_singleton_method(mod, "log_set", ruby_whisper_##log_queue##_s_log_set, 2); \
43
43
  rb_set_end_proc(ruby_whisper_##log_queue##_end_proc, Qnil); \
44
- rb_extend_object(mod, mLogSettable); \
45
- rb_funcall(mLogSettable, id_extended, 1, mod);
44
+ rb_extend_object(mod, mLogSettable);
46
45
 
47
46
  #endif
@@ -446,7 +446,7 @@ ruby_whisper_params_allocate(VALUE klass)
446
446
  rwp->params.vad_model_path = ruby_strdup(rwp->params.vad_model_path);
447
447
  }
448
448
  rwp->diarize = false;
449
- rwp->vad_params = TypedData_Wrap_Struct(cVADParams, &ruby_whisper_vad_params_type, (void *)&rwp->params.vad_params);
449
+ rwp->vad_params = rb_class_new_instance(0, NULL, cVADParams);
450
450
  rwp->new_segment_callback_container = ruby_whisper_callback_container_allocate();
451
451
  rwp->progress_callback_container = ruby_whisper_callback_container_allocate();
452
452
  rwp->encoder_begin_callback_container = ruby_whisper_callback_container_allocate();
@@ -918,7 +918,7 @@ ruby_whisper_params_set_temperature(VALUE self, VALUE value)
918
918
  {
919
919
  ruby_whisper_params *rwp;
920
920
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
921
- rwp->params.temperature = RFLOAT_VALUE(value);
921
+ rwp->params.temperature = NUM2DBL(value);
922
922
  return value;
923
923
  }
924
924
  /*
@@ -943,7 +943,7 @@ ruby_whisper_params_set_max_initial_ts(VALUE self, VALUE value)
943
943
  {
944
944
  ruby_whisper_params *rwp;
945
945
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
946
- rwp->params.max_initial_ts = RFLOAT_VALUE(value);
946
+ rwp->params.max_initial_ts = NUM2DBL(value);
947
947
  return value;
948
948
  }
949
949
  /*
@@ -966,7 +966,7 @@ ruby_whisper_params_set_length_penalty(VALUE self, VALUE value)
966
966
  {
967
967
  ruby_whisper_params *rwp;
968
968
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
969
- rwp->params.length_penalty = RFLOAT_VALUE(value);
969
+ rwp->params.length_penalty = NUM2DBL(value);
970
970
  return value;
971
971
  }
972
972
  /*
@@ -989,7 +989,7 @@ ruby_whisper_params_set_temperature_inc(VALUE self, VALUE value)
989
989
  {
990
990
  ruby_whisper_params *rwp;
991
991
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
992
- rwp->params.temperature_inc = RFLOAT_VALUE(value);
992
+ rwp->params.temperature_inc = NUM2DBL(value);
993
993
  return value;
994
994
  }
995
995
  /*
@@ -1014,7 +1014,7 @@ ruby_whisper_params_set_entropy_thold(VALUE self, VALUE value)
1014
1014
  {
1015
1015
  ruby_whisper_params *rwp;
1016
1016
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
1017
- rwp->params.entropy_thold = RFLOAT_VALUE(value);
1017
+ rwp->params.entropy_thold = NUM2DBL(value);
1018
1018
  return value;
1019
1019
  }
1020
1020
  /*
@@ -1037,7 +1037,7 @@ ruby_whisper_params_set_logprob_thold(VALUE self, VALUE value)
1037
1037
  {
1038
1038
  ruby_whisper_params *rwp;
1039
1039
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
1040
- rwp->params.logprob_thold = RFLOAT_VALUE(value);
1040
+ rwp->params.logprob_thold = NUM2DBL(value);
1041
1041
  return value;
1042
1042
  }
1043
1043
  /*
@@ -1060,7 +1060,7 @@ ruby_whisper_params_set_no_speech_thold(VALUE self, VALUE value)
1060
1060
  {
1061
1061
  ruby_whisper_params *rwp;
1062
1062
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
1063
- rwp->params.no_speech_thold = RFLOAT_VALUE(value);
1063
+ rwp->params.no_speech_thold = NUM2DBL(value);
1064
1064
  return value;
1065
1065
  }
1066
1066
  static VALUE
@@ -1307,6 +1307,7 @@ static VALUE
1307
1307
  ruby_whisper_params_set_vad_params(VALUE self, VALUE value)
1308
1308
  {
1309
1309
  ruby_whisper_params *rwp;
1310
+ rb_check_typeddata(value, &ruby_whisper_vad_params_type);
1310
1311
  TypedData_Get_Struct(self, ruby_whisper_params, &ruby_whisper_params_type, rwp);
1311
1312
  rwp->vad_params = value;
1312
1313
  return value;
@@ -15,28 +15,9 @@ extern ID id_call;
15
15
  extern ID id_to_path;
16
16
  extern ID transcribe_option_names[1];
17
17
 
18
- extern void prepare_transcription(ruby_whisper_params * rwp, VALUE * self, int n_processors);
19
18
  extern VALUE full_body(VALUE rb_args);
20
19
  extern VALUE full_parallel_body(VALUE rb_args);
21
20
 
22
- typedef struct{
23
- struct whisper_context *context;
24
- struct whisper_full_params *params;
25
- float *samples;
26
- size_t n_samples;
27
- int n_processors;
28
- int result;
29
- } transcribe_without_gvl_args;
30
-
31
- static void*
32
- transcribe_without_gvl(void *rb_args)
33
- {
34
- transcribe_without_gvl_args *args = (transcribe_without_gvl_args *)rb_args;
35
- args->result = whisper_full_parallel(args->context, *args->params, args->samples, args->n_samples, args->n_processors);
36
-
37
- return NULL;
38
- }
39
-
40
21
  /*
41
22
  * transcribe a single file
42
23
  * can emit to a block results
@@ -12,13 +12,6 @@ extern VALUE release_samples(VALUE parsed);
12
12
 
13
13
  extern VALUE ruby_whisper_vad_segments_s_init(struct whisper_vad_segments *segments);
14
14
 
15
- typedef struct segments_from_samples_args {
16
- VALUE *context;
17
- VALUE *params;
18
- float *samples;
19
- int n_samples;
20
- } segments_from_samples_args;
21
-
22
15
  static size_t
23
16
  ruby_whisper_vad_context_memsize(const void *p)
24
17
  {
@@ -77,7 +70,24 @@ ruby_whisper_vad_context_initialize(VALUE self, VALUE model_path)
77
70
  return Qnil;
78
71
  }
79
72
 
80
- static VALUE
73
+ typedef struct {
74
+ struct whisper_vad_context *context;
75
+ struct whisper_vad_params *params;
76
+ float *samples;
77
+ int n_samples;
78
+ struct whisper_vad_segments *result;
79
+ } segments_from_samples_without_gvl_args;
80
+
81
+ static void*
82
+ segments_from_samples_without_gvl(void *rb_args)
83
+ {
84
+ segments_from_samples_without_gvl_args *args = (segments_from_samples_without_gvl_args *)rb_args;
85
+ args->result = whisper_vad_segments_from_samples(args->context, *args->params, args->samples, args->n_samples);
86
+
87
+ return NULL;
88
+ }
89
+
90
+ VALUE
81
91
  segments_from_samples_body(VALUE rb_args)
82
92
  {
83
93
  segments_from_samples_args *args = (segments_from_samples_args *)rb_args;
@@ -87,9 +97,19 @@ segments_from_samples_body(VALUE rb_args)
87
97
  GetVADContext(*args->context, rwvc);
88
98
  GetVADParams(*args->params, rwvp);
89
99
 
90
- struct whisper_vad_segments *segments = whisper_vad_segments_from_samples(rwvc->context, rwvp->params, args->samples, args->n_samples);
100
+ segments_from_samples_without_gvl_args segments_from_samples_without_gvl_args = {
101
+ rwvc->context,
102
+ &rwvp->params,
103
+ args->samples,
104
+ args->n_samples,
105
+ NULL
106
+ };
107
+ rb_thread_call_without_gvl(segments_from_samples_without_gvl, (void *)&segments_from_samples_without_gvl_args, NULL, NULL);
108
+ if (!segments_from_samples_without_gvl_args.result) {
109
+ rb_raise(rb_eRuntimeError, "Failed to process audio");
110
+ }
91
111
 
92
- return ruby_whisper_vad_segments_s_init(segments);
112
+ return ruby_whisper_vad_segments_s_init(segments_from_samples_without_gvl_args.result);
93
113
  }
94
114
 
95
115
  static VALUE
@@ -16,18 +16,16 @@ extern const rb_data_type_t ruby_whisper_vad_params_type;
16
16
  extern const rb_data_type_t ruby_whisper_vad_segments_type;
17
17
 
18
18
  extern VALUE ruby_whisper_vad_segments_s_init(struct whisper_vad_segments *segments);
19
+ extern VALUE segments_from_samples_body(VALUE rb_args);
19
20
 
20
21
  VALUE
21
22
  ruby_whisper_vad_detect(VALUE self, VALUE file_path, VALUE params) {
22
23
  ruby_whisper_vad_context *rwvc;
23
- ruby_whisper_vad_params *rwvp;
24
24
  std::string cpp_file_path;
25
25
  std::vector<float> pcmf32;
26
26
  std::vector<std::vector<float>> pcmf32s;
27
- whisper_vad_segments *segments;
28
27
 
29
28
  GetVADContext(self, rwvc);
30
- TypedData_Get_Struct(params, ruby_whisper_vad_params, &ruby_whisper_vad_params_type, rwvp);
31
29
 
32
30
  if (rb_respond_to(file_path, id_to_path)) {
33
31
  file_path = rb_funcall(file_path, id_to_path, 0);
@@ -38,12 +36,13 @@ ruby_whisper_vad_detect(VALUE self, VALUE file_path, VALUE params) {
38
36
  rb_raise(rb_eRuntimeError, "Failed to open '%s' as WAV file\n", cpp_file_path.c_str());
39
37
  }
40
38
 
41
- segments = whisper_vad_segments_from_samples(rwvc->context, rwvp->params, pcmf32.data(), pcmf32.size());
42
- if (segments == nullptr) {
43
- rb_raise(rb_eRuntimeError, "Failed to process audio\n");
44
- }
45
-
46
- return ruby_whisper_vad_segments_s_init(segments);
39
+ segments_from_samples_args args = {
40
+ &self,
41
+ &params,
42
+ pcmf32.data(),
43
+ (int)pcmf32.size(),
44
+ };
45
+ return segments_from_samples_body((VALUE)&args);
47
46
  }
48
47
 
49
48
  #ifdef __cplusplus
@@ -31,7 +31,7 @@ static ID id_samples_overlap;
31
31
 
32
32
  const rb_data_type_t ruby_whisper_vad_params_type = {
33
33
  "ruby_whisper_vad_params",
34
- {0, 0, ruby_whisper_vad_params_memsize,},
34
+ {0, RUBY_DEFAULT_FREE, ruby_whisper_vad_params_memsize,},
35
35
  0, 0,
36
36
  0
37
37
  };
@@ -56,7 +56,7 @@ ruby_whisper_vad_params_set_threshold(VALUE self, VALUE value)
56
56
  {
57
57
  ruby_whisper_vad_params *rwvp;
58
58
  TypedData_Get_Struct(self, ruby_whisper_vad_params, &ruby_whisper_vad_params_type, rwvp);
59
- rwvp->params.threshold = RFLOAT_VALUE(value);
59
+ rwvp->params.threshold = NUM2DBL(value);
60
60
  return value;
61
61
  }
62
62
 
@@ -125,7 +125,7 @@ ruby_whisper_vad_params_set_max_speech_duration_s(VALUE self, VALUE value)
125
125
  {
126
126
  ruby_whisper_vad_params *rwvp;
127
127
  TypedData_Get_Struct(self, ruby_whisper_vad_params, &ruby_whisper_vad_params_type, rwvp);
128
- rwvp->params.max_speech_duration_s = RFLOAT_VALUE(value);
128
+ rwvp->params.max_speech_duration_s = NUM2DBL(value);
129
129
  return value;
130
130
  }
131
131
 
@@ -171,7 +171,7 @@ ruby_whisper_vad_params_set_samples_overlap(VALUE self, VALUE value)
171
171
  {
172
172
  ruby_whisper_vad_params *rwvp;
173
173
  TypedData_Get_Struct(self, ruby_whisper_vad_params, &ruby_whisper_vad_params_type, rwvp);
174
- rwvp->params.samples_overlap = RFLOAT_VALUE(value);
174
+ rwvp->params.samples_overlap = NUM2DBL(value);
175
175
  return value;
176
176
  }
177
177
 
@@ -68,7 +68,7 @@ ruby_whisper_vad_segment_get_start_time(VALUE self)
68
68
  TypedData_Get_Struct(self, ruby_whisper_vad_segment, &ruby_whisper_vad_segment_type, rwvs);
69
69
  TypedData_Get_Struct(rwvs->segments, ruby_whisper_vad_segments, &ruby_whisper_vad_segments_type, rwvss);
70
70
  t0 = whisper_vad_segments_get_segment_t0(rwvss->segments, rwvs->index);
71
- return DBL2NUM(t0 * 10);
71
+ return LONG2NUM(t0 * 10);
72
72
  }
73
73
 
74
74
  static VALUE
@@ -81,7 +81,7 @@ ruby_whisper_vad_segment_get_end_time(VALUE self)
81
81
  TypedData_Get_Struct(self, ruby_whisper_vad_segment, &ruby_whisper_vad_segment_type, rwvs);
82
82
  TypedData_Get_Struct(rwvs->segments, ruby_whisper_vad_segments, &ruby_whisper_vad_segments_type, rwvss);
83
83
  t1 = whisper_vad_segments_get_segment_t1(rwvss->segments, rwvs->index);
84
- return DBL2NUM(t1 * 10);
84
+ return LONG2NUM(t1 * 10);
85
85
  }
86
86
 
87
87
  static VALUE
@@ -1,6 +1,6 @@
1
1
  cmake_minimum_required(VERSION 3.5) # for add_link_options and implicit target directories.
2
2
  project("whisper.cpp" C CXX)
3
- project("whisper.cpp" VERSION 1.9.0)
3
+ project("whisper.cpp" VERSION 1.9.1)
4
4
  include(CheckIncludeFileCXX)
5
5
 
6
6
  set(SOVERSION 1)
@@ -19,6 +19,7 @@ endif()
19
19
  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
20
20
 
21
21
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
22
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
22
23
 
23
24
  if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
24
25
  set(WHISPER_STANDALONE ON)
@@ -1,7 +1,7 @@
1
1
  prefix=@CMAKE_INSTALL_PREFIX@
2
2
  exec_prefix=${prefix}
3
- libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
4
- includedir=${prefix}/include
3
+ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4
+ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5
5
 
6
6
  Name: parakeet
7
7
  Description: Port of NVIDIA's Parakeet model in C/C++
@@ -1,7 +1,7 @@
1
1
  prefix=@CMAKE_INSTALL_PREFIX@
2
2
  exec_prefix=${prefix}
3
- libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
4
- includedir=${prefix}/include
3
+ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4
+ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5
5
 
6
6
  Name: whisper
7
7
  Description: Port of OpenAI's Whisper model in C/C++
@@ -465,7 +465,15 @@ static void output_txt(struct whisper_context * ctx, std::ofstream & fout, const
465
465
  speaker = estimate_diarization_speaker(pcmf32s, t0, t1);
466
466
  }
467
467
 
468
- fout << speaker << text << "\n";
468
+ if (!speaker.empty()) {
469
+ fout << speaker << text;
470
+ } else {
471
+ while (*text == ' ' || *text == '\t') {
472
+ text++;
473
+ }
474
+ fout << text;
475
+ }
476
+ fout << "\n";
469
477
  }
470
478
  }
471
479
 
@@ -75,6 +75,7 @@ bool ggml_common_quantize_0(
75
75
  case GGML_FTYPE_MOSTLY_MXFP4:
76
76
  case GGML_FTYPE_MOSTLY_NVFP4:
77
77
  case GGML_FTYPE_MOSTLY_Q1_0:
78
+ case GGML_FTYPE_MOSTLY_Q2_0:
78
79
  {
79
80
  fprintf(stderr, "%s: invalid model type %d\n", __func__, ftype);
80
81
  return false;
@@ -217,6 +218,7 @@ bool ggml_common_quantize_0(
217
218
  case GGML_TYPE_MXFP4:
218
219
  case GGML_TYPE_NVFP4:
219
220
  case GGML_TYPE_Q1_0:
221
+ case GGML_TYPE_Q2_0:
220
222
  case GGML_TYPE_COUNT:
221
223
  {
222
224
  fprintf(stderr, "%s: unsupported quantization type %d (%s)\n", __func__, ttype, ggml_type_name((ggml_type) ttype));
@@ -26,6 +26,7 @@ static void vad_print_usage(int /*argc*/, char ** argv, const cli_params & param
26
26
  fprintf(stderr, "\n");
27
27
  fprintf(stderr, "usage: %s [options] file\n", argv[0]);
28
28
  fprintf(stderr, "supported audio formats: flac, mp3, ogg, wav\n");
29
+ fprintf(stderr, "Note: Output timestamps are in centiseconds (1/100th of a second).\n");
29
30
  fprintf(stderr, "\n");
30
31
  fprintf(stderr, "options:\n");
31
32
  fprintf(stderr, " -h, --help [default] show this help message and exit\n");
@@ -64,7 +65,7 @@ static bool vad_params_parse(int argc, char ** argv, cli_params & params) {
64
65
  else if (arg == "-ug" || arg == "--use-gpu") { params.use_gpu = true; }
65
66
  else if (arg == "-vm" || arg == "--vad-model") { params.vad_model = ARGV_NEXT; }
66
67
  else if (arg == "-vt" || arg == "--vad-threshold") { params.vad_threshold = std::stof(ARGV_NEXT); }
67
- else if (arg == "-vsd" || arg == "--vad-min-speech-duration-ms") { params.vad_min_speech_duration_ms = std::stoi(ARGV_NEXT); }
68
+ else if (arg == "-vspd" || arg == "--vad-min-speech-duration-ms") { params.vad_min_speech_duration_ms = std::stoi(ARGV_NEXT); }
68
69
  else if (arg == "-vsd" || arg == "--vad-min-silence-duration-ms") { params.vad_min_speech_duration_ms = std::stoi(ARGV_NEXT); }
69
70
  else if (arg == "-vmsd" || arg == "--vad-max-speech-duration-s") { params.vad_max_speech_duration_s = std::stof(ARGV_NEXT); }
70
71
  else if (arg == "-vp" || arg == "--vad-speech-pad-ms") { params.vad_speech_pad_ms = std::stoi(ARGV_NEXT); }
@@ -122,7 +123,7 @@ int main(int argc, char ** argv) {
122
123
  return 3;
123
124
  }
124
125
 
125
- // Get the the vad segements using the probabilities that have been computed
126
+ // Get the the vad segments using the probabilities that have been computed
126
127
  // previously and stored in the whisper_vad_context.
127
128
  struct whisper_vad_params params = whisper_vad_default_params();
128
129
  params.threshold = cli_params.vad_threshold;
@@ -4,8 +4,8 @@ project("ggml" C CXX ASM)
4
4
 
5
5
  ### GGML Version
6
6
  set(GGML_VERSION_MAJOR 0)
7
- set(GGML_VERSION_MINOR 15)
8
- set(GGML_VERSION_PATCH 1)
7
+ set(GGML_VERSION_MINOR 16)
8
+ set(GGML_VERSION_PATCH 0)
9
9
  set(GGML_VERSION_BASE "${GGML_VERSION_MAJOR}.${GGML_VERSION_MINOR}.${GGML_VERSION_PATCH}")
10
10
 
11
11
  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
@@ -249,7 +249,7 @@ option(GGML_SYCL "ggml: use SYCL"
249
249
  option(GGML_SYCL_F16 "ggml: use 16 bit floats for sycl calculations" OFF)
250
250
  option(GGML_SYCL_GRAPH "ggml: enable graphs in the SYCL backend" ON)
251
251
  option(GGML_SYCL_HOST_MEM_FALLBACK "ggml: allow host memory fallback in SYCL reorder (requires kernel 6.8+)" ON)
252
- option(GGML_SYCL_SUPPORT_LEVEL_ZERO "ggml: use Level Zero API in SYCL backend" ON)
252
+ option(GGML_SYCL_SUPPORT_LEVEL_ZERO_API "ggml: use Level Zero API in SYCL backend" ON)
253
253
  option(GGML_SYCL_DNN "ggml: enable oneDNN in the SYCL backend" ON)
254
254
  set (GGML_SYCL_TARGET "INTEL" CACHE STRING
255
255
  "ggml: sycl target device")
@@ -266,7 +266,6 @@ set (GGML_OPENCL_TARGET_VERSION "300" CACHE STRING
266
266
  "ggml: OpenCL API version to target")
267
267
 
268
268
  option(GGML_HEXAGON "ggml: enable Hexagon backend" OFF)
269
- set(GGML_HEXAGON_FP32_QUANTIZE_GROUP_SIZE 128 CACHE STRING "ggml: quantize group size (32, 64, or 128)")
270
269
 
271
270
  # toolchain for vulkan-shaders-gen
272
271
  set (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN "" CACHE FILEPATH "ggml: toolchain file for vulkan-shaders-gen")
@@ -30,9 +30,6 @@ GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_cuda_buffer_type(int de
30
30
  // conduct allreduce operation between devices
31
31
  GGML_BACKEND_API bool ggml_backend_cuda_allreduce_tensor(ggml_backend_t * backends, struct ggml_tensor ** tensors, size_t n_backends);
32
32
 
33
- // split tensor buffer that splits matrices by rows across multiple devices
34
- GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_cuda_split_buffer_type(int main_device, const float * tensor_split);
35
-
36
33
  // pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
37
34
  GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_cuda_host_buffer_type(void);
38
35
 
@@ -27,6 +27,14 @@ GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_buffer_type(int de
27
27
  // split tensor buffer that splits matrices by rows across multiple devices
28
28
  GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_split_buffer_type(const float * tensor_split);
29
29
 
30
+ // Tensor parallelism (--split-mode tensor): comm_init/free/allreduce_tensor
31
+ // trio queried by the meta-backend via ggml_backend_reg_get_proc_address.
32
+ // See typedefs in ggml/include/ggml-backend.h. Mirrors the CUDA backend's
33
+ // pattern (ggml_backend_cuda_comm_*).
34
+ GGML_BACKEND_API void * ggml_backend_sycl_comm_init(ggml_backend_t * backends, size_t n_backends);
35
+ GGML_BACKEND_API void ggml_backend_sycl_comm_free(void * comm_ctx);
36
+ GGML_BACKEND_API bool ggml_backend_sycl_comm_allreduce_tensor(void * comm_ctx, struct ggml_tensor ** tensors);
37
+
30
38
  // pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
31
39
  GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void);
32
40
 
@@ -429,7 +429,8 @@ extern "C" {
429
429
  GGML_TYPE_MXFP4 = 39, // MXFP4 (1 block)
430
430
  GGML_TYPE_NVFP4 = 40, // NVFP4 (4 blocks, E4M3 scale)
431
431
  GGML_TYPE_Q1_0 = 41,
432
- GGML_TYPE_COUNT = 42,
432
+ GGML_TYPE_Q2_0 = 42,
433
+ GGML_TYPE_COUNT = 43,
433
434
  };
434
435
 
435
436
  // precision
@@ -473,6 +474,7 @@ extern "C" {
473
474
  GGML_FTYPE_MOSTLY_MXFP4 = 25, // except 1d tensors
474
475
  GGML_FTYPE_MOSTLY_NVFP4 = 26, // except 1d tensors
475
476
  GGML_FTYPE_MOSTLY_Q1_0 = 27, // except 1d tensors
477
+ GGML_FTYPE_MOSTLY_Q2_0 = 28, // except 1d tensors
476
478
  };
477
479
 
478
480
  // available tensor operations:
@@ -438,7 +438,14 @@ if (GGML_CPU_ALL_VARIANTS)
438
438
  ggml_add_cpu_backend_variant(power8_2 POWER8 VSX)
439
439
  ggml_add_cpu_backend_variant(power9 POWER9 VSX)
440
440
  ggml_add_cpu_backend_variant(power10 POWER10 VSX)
441
- ggml_add_cpu_backend_variant(power11 POWER11 VSX)
441
+ # POWER11 backend: only if compiler supports -mcpu=power11
442
+ check_cxx_compiler_flag("-mcpu=power11" GGML_CXX_SUPPORTS_POWER11)
443
+ if (GGML_CXX_SUPPORTS_POWER11)
444
+ message(STATUS "Compiler supports -mcpu=power11, enabling POWER11 backend")
445
+ ggml_add_cpu_backend_variant(power11 POWER11 VSX)
446
+ else()
447
+ message(STATUS "Skipping POWER11 backend: compiler does not support -mcpu=power11")
448
+ endif()
442
449
  else()
443
450
  message(FATAL_ERROR "Unsupported PowerPC target OS: ${CMAKE_SYSTEM_NAME}")
444
451
  endif()