Commit Graph

14 Commits

Author SHA1 Message Date
KITAITI Makoto
941bdabbe4
ruby : add Whisper::Context::Params, fix token memory management (#3647)
* Don't convert to temporary VALUE

* Define Whisper::Context::Params

* Add test for Whisper::Context::Params

* Implement Whisper::Context::Params

* Add tests for Context::Params

* Fix Whisper::Token memory management

* Add test for token_timestamps

* Make Context accept Context::Params

* Make Context::Params.new accept keyword args

* Add test for Context::Params.new with keyword args

* Add signature of Context::Params

* Add example for Whisper::Token

* Fix typos

* Revert "Don't convert to temporary VALUE"

This reverts commit dee66e7384.

* Hold Token#text as Ruby objectd

* Don't use pointer for ruby_whisper_context_params.params

* Use RUBY_DEFAULT_FREE instead of custom function

* Update bindings/ruby/README.md

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>

* Add document for Whisper::Context::Params

---------

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2026-02-04 20:33:09 +09:00
KITAITI Makoto
aa1bc0d1a6
ruby : add VAD::Context#segments_from_samples, allow Pathname, etc. (#3633)
* ruby : Bump version to 1.3.6

* Fix code in example

* Add sample code to transcribe from MemoryView

* Define GetVADContext macro

* Use GetVADContext

* Extract parse_full_args function

* Use parse_full_args in ruby_whisper_full_parallel

* Free samples after use

* Check return value of parse_full_args()

* Define GetVADParams macro

* Add VAD::Context#segments_from_samples

* Add tests for VAD::Context#segments_from_samples

* Add signature for VAD::Context#segments_from_samples

* Add sample code for VAD::Context#segments_from_samples

* Add test for Whisper::Context#transcribe with Pathname

* Make Whisper::Context#transcribe and Whisper::VAD::Context#detect accept Pathname

* Update signature of Whisper::Context#transcribe

* Fix variable name

* Don't free memory view

* Make parse_full_args return struct

* Fallback when failed to get MemoryView

* Add num of samples when too long

* Check members of MemoryView

* Fix a typo

* Remove unnecessary include

* Fix a typo

* Fix a typo

* Care the case of MemoryView doesn't fit spec

* Add TODO comment

* Add optimazation option to compiler flags

* Use ALLOC_N instead of malloc

* Add description to sample code

* Rename and change args: parse_full_args -> parse_samples

* Free samples when exception raised

* Assign type check result to a variable

* Define wrapper function of whisper_full

* Change signature of parse_samples for rb_ensure

* Ensure release MemoryView

* Extract fill_samples function

* Free samples memory when filling it failed

* Free samples memory when transcription failed

* Prepare transcription in wrapper funciton

* Change function name

* Simplify function boundary
2026-01-30 22:59:36 +09:00
KITAITI Makoto
679bdb53db
ruby : fix segmentation fault (#3591)
* Mark long live variable

* Fix test for Whisper::Token#deconstruct_keys(nil)

* Don't use long live variable

* Fix indentation
2026-01-05 17:41:22 +09:00
KITAITI Makoto
6114e69213
ruby : add Whisper::Token, fix model URI (#3575)
* Define and use macro to get context safely

* Add test to check SEGV

* Move installation guid after usage

* [skip ci]Change doc slightly

* [skip ci]Fix a typo in README

* [skip ci]Add carry_initial_prompt option in README

* Define GetVADSegments and use it

* Use GetContext

* Fix download URI of small.en-tdrz

* Fix URI of CoreML models corresponding to quantized models

* Cache computed string

* Remove unused argument

* Add Whisper::Token

* Add document comments

* Rename function: rb_whisper_token_s_new -> ruby_whisper_token_s_init

* Fix size of token

* Insert _get into function names

* Add Whisper::Token#text

* Add test for Whisper::Token#text

* Declare static if possible

* Change method names

* Add Whisper::Token#deconstruct_keys

* Add tests for Whisper::Token#deconstruct_keys

* Add signatures for Whisper::Token

* Complete signature

* [skip ci]Add n_tokens to document of Segment
2025-12-24 16:52:16 +09:00
KITAITI Makoto
27f485a14c
vad : Silero VAD v6.2.0 (#3524)
* Add ggml-silero-v6.2.0 to download candidates

* Make default VAD model ggml-silero-v6.2.0

* Make VAD model in documentations ggml-silero-v6.2.0
2025-11-17 22:26:17 +09:00
KITAITI Makoto
d9b7613b34
ruby : VAD separately from ASR (#3518)
* Add Whisper::VAD::Context

* Add test for Whisper::VAD::Context

* Add Whisper::VAD::Segment

* Add Whisper::VAD::Segments

* Add Whisper::VAD::Context#detect

* Define Whisper::VAD::Segments#each

* Define Whisper::VAD::Segment#start_time and #end_time

* Define Whisper::VAD::Segment#deconstruct_keys

* Add tests for Whisper::VAD family

* Add signatures for VAD family

* Add document on VAD in README

* Define Whisper::VAD::Segments#length

* Add test for Whisper::VAD::Segments#length

* Add signature of Segments#length

* Make vad_segments responsible to initialize VAD::Segments

* Remove meaningless argument check

* Check NULL of segments member

* Add tests for Whisper::VAD::Segments

* Initialize Whisper::VAD::Segment on .allocate

* Add tests for Whisper::VAD::Segment

* Check NULL of context member

* Add test for Whisper::VAD::Context.allocate
2025-11-13 10:15:26 +09:00
KITAITI Makoto
c62adfbd1e
ruby : tiny bug fix (#3490)
* Remove build-xcframework.sh from package

* Remove unused variable

* Bump version to 1.3.5

* Don't use variable before declaration
2025-10-29 03:50:44 +09:00
Andreas Lubbe
85871a9469
whisper : add support for --carry-initial-prompt (#3395)
* Add support for --carry-initial-prompt

* PR fixes for ruby and go

* Refactoring for readability

* WIP 1

* WIP 2

* PR fixes

* More PR fixes

* PR fix

* Further simplification

* d'oh

* One more logic fix

* Update src/whisper.cpp

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* Truncate prompt_past0 upon initialization

* Slight simplification

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2025-10-10 19:51:15 +03:00
KITAITI Makoto
7849aff7a2
ruby : Loose RegExp for test (#3448) 2025-10-01 15:33:11 +03:00
Adam Debono
4245c77b65
ruby : Add ruby binding for max_len (#3365)
* add ruby binding for max_len

* add test, update param numbers
2025-08-07 11:37:45 +09:00
KITAITI Makoto
f8abbeb234
ruby : add Whisper::VERSION (#3292)
* Add a test for segment

* Check option existence

* Use more proper variable to define build option

* Assert Core ML enabled

* Define Whisper::VERSION

* Add test for Whisper::VERSION

* Add signature of Whisper::VERSION
2025-06-27 04:41:26 +02:00
KITAITI Makoto
cead8f5357
ruby : specify Apple frameworks explicitly on build (#3270)
* Add Apple frameworks to $LDFLAGS when needed

* Add utility method to Options

* Remove unnecessary propaty date from gemspec

* Add Apple frameworks for CoreML build

* Add Accelerate framework only for Apple platform

* Fix ZipURI#cache signature

* Download test fixtures if needed
2025-06-23 06:34:05 +02:00
KITAITI Makoto
fbead67549
ruby : output format (#3237)
* Fix a typo

* Don't allocate output string unless needed

* Add methods to output SRT and WebVTT

* Add tests for output methods

* Make constants for output private

* Add signatures for output methods

* Add document on output methods

* Fix method name: Segment#speaker_next_turn? -> #speacker_turn_next?

* Add Whisper::Segment#descotruct_keys

* Add test for Whisper::Context#descotruct_keys

* Add signature of Whisper::Segment#deconstruct_keys

* Use parentheses to suppress warning

* Update date
2025-06-10 06:10:17 +02:00
KITAITI Makoto
799eacdde4
ruby : Add parallel transcription support (#3222)
* Fix indentation of code sample in document comment

* Make Whisper::Context#transcribe able to run non-parallel

* Add test for Whisper::Context#transcribe with parallel option

* Follow signature API change of Context#transcribe

* Remove useless variable assignment

* Move simple usage up in README

* Add need help section in README

* Add document on Context#transcribe's parallel option in README

* Update date

* Fix signature of Context.new

* Make Context#subscribe accept n_processors option

* Make test follow #transcribe's change

* Make RBS follow #transcribe's change

* Add document for #transcribe's n_processors option

* Rename test directory so that Rake tasks' default setting is used
2025-06-04 14:50:18 +09:00