* Add Whisper::Parakeet::Params
* Add tests for Parakeet::Params
* Remove unused variabel
* Add callbacks to Parakeet::Params
* Group callback and user_data params
* Undefine local macros
* Define GetParakeetParams
* Remove unused variable
* Use ITERATE_CALLBACK_PARAMS
* Use ITERATE_CALLBACK_PARAMS instead of ITERATE_USER_DATA_PARAMS
* Fix memsize
* Remove unnecessary macros
* Simplify params registration
* Define Parakeet
* Add hook methods to Parakeet::Params
* Fix typo
* Check callback container in GetParakeetParams
* Reduce if
* Free parakeet_full_params
* Implement Parakeet::Context#initialize
* Add TestParakeetContext
* Add Parakeet::Segment
* Prevent double-free
* Add Parakeet::Context#transcribe
* Add Parakeet::Context#each_segment
* Define Parakeet::Segment attributes
* Define Parakeet::Segment#deconstruct_keys
* Add tests for Parakeet::Segment#deconstruct_keys
* Run Parakeet::Context#transcribe without GVL
* Make it to abort for Parakeet
* Add Parakeet.log_set
* Define Parakeet::Token
* Define Parakeet::Segment#each_token
* Implement some hooks of Parakeet::Params
* Convert int to VALUE
* Implement hooks for Parakeet
* Implement Parakeet::Context#full
* Add tests for Parakeet::Context#full
* Add Parakeet to RBS
* Fix ruby_whisper_parakeet_params_free
* Free ruby_whisper_parakeet_context
* Add tests for hooks
* Add Parakeet section to README
* Add more attributes of Parakeet::Context
* Add tests for Parakeet::Context's attributes
* Update RBS
* Register parakeet-tdt-0.6b-v3
* Narrow scope of log constants
* Extract activate and deactivate of log_queue
* Make start_log_callback_thread private
* Don't call start_log_callback_thread unncecessarilly
* Early return from log_queue_enqueue when not active
* Gropu log_queue members
* is_active -> is_open
* Fix English
* Share parakeet full body function
* ruby_whisper_parakeet_abort_callback_user_data -> ruby_whisper_abort_callback_user_data
* NULL check for callback containers
* Fix Parakeet.log_set
* Omit Parakeet tests on CI
* Extract Whisper::LogSettable
* Join log callback thread in a log queue function
* Revert Join log callback thread in a log queue function
* Extract output methods to modules
* Move Parakeet init functions into init_parakeet()
* Add output methods to Parakeet classes
* Add Parakeet's output methods to RBS
* Use Whisper::Output in RBS
* Add LogSettable to RBS
* Fix module Token -> class Token
* Add Parakeet::Model
* Add test for Parakeet::Model
* Add Parakeet::Model to RBS
* Move position of Parakeet::Model in RBS
* Parakeet -> TestBase::Parakeet
* Add Parakeet::Context#model in RBS
* Add Whisper::Output
* Fix nil check
* Define ruby_whisper_parakeet_model_memsize
* Fix order of declaration in ruby_whisper_parakeet_model_get_xxx
* Define Parakeet.system_info_str
* Add test for Parakeet.system_info_str
* Add signature of Parakeet.system_info_str
* Define Parakeet::VERSION
* Add test for Parakeet::VERSION
* Add signature of Parakeet::VERSION
* Add Parakeet::Context::Params
* Make Parakeet::Context.new accept Context::Params
* Add test for Parakeet::Context.new with Context::Params
* Update RBS
* Remove params from Parakeet::Params which are moved from whisper_parakeet_full_params
* Remove tests for removed params
* Make Parakeet tests follow original behavior changes
* Add Parakeet model shortcuts
* Alloc token data in factory instead of alloc func
* Fix variable name
* Update RBS
* Refactor log settable module
* Use log settable for Whisper
* Address deadlock
* Make test follow change of log queue implementation
* Refactor to make abort callback use the same way to parakeet's way
* Remove redundant structs
* Fix test name
* Fix README
* Add missing parallel transcription
* Fix test for parakeet info
* Remove removed params
* Wait for logs dequeued
* Fix instance variable name
* Load etc feature
* Remove unnecessary comment
* Remove unnecessary thread safety check
* Remove outdated comment
* Skip downloading model if cache exists
* Change Hugging Face URI for Parakeet models
* Bump required Ruby version to 3.3
* Fix English
* fix: V-002 security vulnerability
Automated security fix generated by Orbis Security AI
* fix(ruby): use Ruby allocator macros in jfk_reader and fix memory leak
- Replace calloc/free with ALLOC_N/xfree to match Ruby binding conventions
(ALLOC_N handles overflow checking and raises NoMemoryError on failure)
- Free temporary samples buffer after conversion loop (was leaked)
- Add NULL check for fopen return value with rb_raise
- Add comment clarifying n_samples is a compile-time constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(ruby): return false instead of rb_raise in memory_view callback
rb_memory_view_get_func_t callbacks should communicate errors via
return value (false), not exceptions. rb_memory_view_get has no
exception-handling wrapper around get_func calls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* replacing ALLOC_N with rb_protect as ALLOC_N raises Ruby exceptions
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Change MemoryView example using NDAV
* Add note on audio attributes for #full and #full_parallel
* Support more variants of MemoryView
* Use IO.popen instead of Kernel.` for Windows compatibility
* Use cmake's -C option instead of multiple -D options
* Fix memsize calculation
* Remove unused argument
* Add is_interrupted field to abort callback container
* Fix RBS syntax
* Address document comment for RDoc
* Add .document for RDoc
* Add .rdoc_options
* Run #full without GVL
* Initialize callbacks with nil
* Specify implicity Whisper::Params to distinguish from Whisper::Context::Params
* Run callbacks without GVL
* Call log callback with GVL
* Run full_parallel without GVL
* Run transcribe without GVL
* Fix ruby_whisper_lock_gvl and ruby_whisper_unlock_gvl
* Fix return value of encoder_begin_callback
* Report GVL unlocking from transcribe
* Remove unused interface
* Restore overload of full_parallel
* Close process
* Fix struct name
* Make is_without_gvl thread local
* Use rb_thread_call_with_gvl instead of global variable
* Retrieve instance variable in GVL
* Narrow acceptable MemoryView format
* Fix option cache path
* Reduce files in package
* Use append_cflags
* Add ext/*.rb to task dependencies
* Use copy instead of cp
* Make TestPackage more portable
* Patch for lower version Ruby
* Make build scripts more portable
* Add Windows support
* Don't raise exceptions
* Prevent dangling pointers
* Use proper free function
* Free callback containers
* Set default log callback when nil is passed to log_set
* Raise error if callbacks set when parallel transcription
* Bump version to 1.3.7
* Make tests follow spec change
* Add note on parallel transcription and callbacks
* Update signature of Whisper.log_set [skip ci]
* 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>
* 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
* 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
* 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
* 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>
This commit disables flash-attention for the Java binding test so that
the testFullTranscribe test passes.
Without this change the test was failing because the expected output
mismatches after the flash-attention change:
```console
<And so my fellow Americans ask not what your country can do for you ask what you can do for your country.>
but was:
<and so my fellow Americans ask not what your country can do for you ask what you can do for your country>
```
An alternative would also be to update the expected output but it felt
better to keep the same expected output and disable flash-attention and
not just change the expected output to match the new behavior.
this might happen depending on the way the $stderr.winsize is defined. If the expression "$stderr.winsize[1] - line.size" in Line 114 gets negative, we will get a "negative argument" exception in the padding calculation
This commit fixes Go bindings build failure for Mac OS X (15.1) which is currently failing.
Co-authored-by: Chaitanya Bayapuneni <bvk@mini.cinnamon-interval.ts.net>
* 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
* 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
This commit adds entries to `.gitignore` for directories in the
`ext` directory.
The motivation for this is that currently after building locally these
following files are reported by git as untracked:
```console
Untracked files:
(use "git add <file>..." to include in what will be committed)
ext/examples/
ext/ggml/
ext/include/
ext/scripts/
ext/src/
```
* ruby : add cleaning of library names in dependencies
This commit adds a cleaning step to the library names in the
`Dependencies` class of the Ruby bindings.
The motivation for this is that with the introduction of a library name
alias for ggml in Commit (b933d17c30
"Add in-build ggml::ggml ALIAS library (ggml/1260)) causes the Makefile
generation to break:
```console
$ sed -n '165,170p' ext/Makefile
CLEANOBJS = $(OBJS) *.bak
TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.time
$(TARGET_SO): libcommon.a libwhisper.a libggml\n(ggml::ggml).a libggml-cpu.a libggml-base.a
libcommon.a libwhisper.a libggml\n(ggml::ggml).a libggml-cpu.a libggml-base.a: cmake-targets
cmake-targets:
/usr/bin/cmake -S sources -B build -D BUILD_SHARED_LIBS=OFF -D CMAKE_ARCHIVE_OUTPUT_DIRECTORY=/home/danbev/work/ai/whisper.cpp/bindings/ruby/ext -D CMAKE_POSITION_INDEPENDENT_CODE=ON
```
* squash! ruby : add cleaning of library names in dependencies
Apply PR review feedback.
* 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
This pull request fixes a bug in the fullTranscribeWithTime method, where the whisperParams argument was declared but never used. As a result, the model did not apply the configuration defined in whisperParams.
* Prevent overflow
* Fix memsize of Whisper::Context
* Rename xxx_initialize to more Ruby-esque name: xxx_s_new
* Define Whisper::Model::ZipURI
* Define Whisper::Model.coreml_compiled_models
* Make Options' @cmake_options Hash
* Use --{enable,disable}-whisper-coreml option for -I/opt/homebrew/opt/llvm/include
* Prepare Core ML model if enabled
* Add test for ZipURI
* Add signatures for ZipURI
* Add Whisper.system_info_str
* Add test for Whisper.system_info_str
* Add signagure for Model.coreml_compiled_models
* Add signature for Whisper.system_info_str
* Add test for Core ML
* Update date
* Maintain .gitignore
* Don't pass empty string to cmake command
* Refactor Dependencies
* Use found cmake path for options
* Maintain extsources.rb
* List dependent files by directory separator agnostic way
* Prepend whitespace before '='
* Handle build options on install
* Remove useless test
* Retrieve gem file name and version from spec file
* Bump version to 1.3.3
* Update date
* Add install option examples
* [skip ci]Remove unused module
* Add VAD models
* Extract function to normalize model path from ruby_whisper_initialize()
* Define ruby_whisper_vad_params struct
* Add VAD-related features to Whisper::Params
* Add tests for VAD-related features
* Define Whisper::VADParams
* Add Whisper::VAD::Params attributes
* Add test suite for VAD::Params
* Make older test to follow namespace change
* Add test for transcription with VAD
* Add assertion for test_vad_params
* Add signatures for VAD-related methods
* Define VAD::Params#==
* Add test for VAD::Params#==
* Fix Params#vad_params
* Add test for Params#vad_params
* Fix signature of Params#vad_params
* Use macro to define VAD::Params params
* Define VAD::Params#initialize
* Add tests for VAD::Params#initialize
* Add signature for VAD::Params.new
* Add documentation on VAD in README
* Wrap register_callbask in prepare_transcription for clear meanings
* Set whisper_params.vad_params just before transcription
* Don't touch NULL
* Define ruby_whisper_params_type
* Use TypedData_XXX for ruby_whisper_params instead of Data_XXX
* Remove unused functions
* Define rb_whisper_model_data_type
* Use TypedData_XXX for ruby_whisper_model instead of Data_XXX
* Define ruby_whisper_segment_type
* Use TypedData_XXX for ruby_whisper_segment instead of Data_XXX
* Define ruby_whisper_type
* Use TypedData_XXX for ruby_whisper instead of Data_XXX
* Qualify with const
This commit adds the `GGML_SYCL_DNN` option to the Ruby bindings for
the GGML library. This option as added to ggml in
Commit (5e7e07758a5f3172380500e173ca71f679bbef1e "sycl: use oneDNN for
matrices multiplication")
The motivation for this change to enable the CI build to pass.
* Test Ruby bindings' extra options only when commanded
* ruby : test extra build options only when env var specified
* Fix extra_options
* Update gem date
This commit omits the test for `test_build_options` when run locally as
it currently fails on Linux and MacOS platforms.
`
The motivation for this change is that currently when running the tests
locally on a non-macOS platform the test fails with the following error:
```console
.F
========================================================================
Failure: test_build_options(TestPackage):
<["ACCELERATE_FRAMEWORK",
"CMAKE_OSX_ARCHITECTURES",
"CMAKE_OSX_SYSROOT",
"FOUNDATION_LIBRARY",
"METALKIT_FRAMEWORK",
"METAL_FRAMEWORK"]> was expected to be empty.
/home/danbev/work/ai/whisper.cpp/bindings/ruby/tests/test_package.rb:43:in `test_build_options'
40: options = BuildOptions::Options.new
41: assert_empty options.missing_options
42: unless ENV["CI"]
=> 43: assert_empty options.extra_options
44: end
45: end
46: end
========================================================================
```