Commit Graph

96 Commits

Author SHA1 Message Date
Kitaiti Makoto ed5887818c Add more attributes of Parakeet::Context 2026-06-17 10:30:57 +09:00
Kitaiti Makoto 49fb119116 Free ruby_whisper_parakeet_context 2026-06-17 10:30:57 +09:00
Kitaiti Makoto cc143b6e10 Fix ruby_whisper_parakeet_params_free 2026-06-17 10:30:57 +09:00
Kitaiti Makoto fd550f77ce Implement Parakeet::Context#full 2026-06-17 10:30:57 +09:00
Kitaiti Makoto b3b9af63b2 Implement hooks for Parakeet 2026-06-17 10:30:57 +09:00
Kitaiti Makoto de505d23ad Convert int to VALUE 2026-06-17 10:30:57 +09:00
Kitaiti Makoto 94f327a67b Implement some hooks of Parakeet::Params 2026-06-17 10:30:57 +09:00
Kitaiti Makoto 10cf358ced Define Parakeet::Segment#each_token 2026-06-17 10:30:57 +09:00
Kitaiti Makoto 997470cfba Define Parakeet::Token 2026-06-17 10:30:57 +09:00
Kitaiti Makoto cc958f0af5 Add Parakeet.log_set 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 4f53fad54e Make it to abort for Parakeet 2026-06-17 10:30:56 +09:00
Kitaiti Makoto ae88b19443 Run Parakeet::Context#transcribe without GVL 2026-06-17 10:30:56 +09:00
Kitaiti Makoto c2c12db7f7 Define Parakeet::Segment#deconstruct_keys 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 63d3136465 Define Parakeet::Segment attributes 2026-06-17 10:30:56 +09:00
Kitaiti Makoto bb096e54ac Add Parakeet::Context#each_segment 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 6bcc09b911 Add Parakeet::Context#transcribe 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 6d2291dc8a Prevent double-free 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 2cfefa926b Add Parakeet::Segment 2026-06-17 10:30:56 +09:00
Kitaiti Makoto fdaf031858 Implement Parakeet::Context#initialize 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 8615ac87ec Free parakeet_full_params 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 3bae1e2f1b Reduce if 2026-06-17 10:30:56 +09:00
Kitaiti Makoto f55f3f347c Check callback container in GetParakeetParams 2026-06-17 10:30:56 +09:00
Kitaiti Makoto a3515ac9fc Fix typo 2026-06-17 10:30:56 +09:00
Kitaiti Makoto d051ab6261 Add hook methods to Parakeet::Params 2026-06-17 10:30:56 +09:00
Kitaiti Makoto c5894984b3 Simplify params registration 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 17bd819585 Remove unnecessary macros 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 1e7c734a1d Fix memsize 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 09eff4d1ba Use ITERATE_CALLBACK_PARAMS instead of ITERATE_USER_DATA_PARAMS 2026-06-17 10:30:56 +09:00
Kitaiti Makoto d051c08841 Use ITERATE_CALLBACK_PARAMS 2026-06-17 10:30:56 +09:00
Kitaiti Makoto cd0e91175a Remove unused variable 2026-06-17 10:30:56 +09:00
Kitaiti Makoto b1dbf7452d Define GetParakeetParams 2026-06-17 10:30:56 +09:00
Kitaiti Makoto f412e289ea Undefine local macros 2026-06-17 10:30:56 +09:00
Kitaiti Makoto f39b100bb0 Group callback and user_data params 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 555569481c Add callbacks to Parakeet::Params 2026-06-17 10:30:56 +09:00
Kitaiti Makoto 703fe18e60 Remove unused variabel 2026-06-17 10:30:56 +09:00
Kitaiti Makoto f3b2ed68e5 Add Whisper::Parakeet::Params 2026-06-17 10:30:56 +09:00
Daniel Bevenius 9efddafb91
parakeet : add support for NVIDIA Parakeet (#3735)
* parakeet : add support for NVIDIA Parakeet


Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2026-06-16 20:44:10 +02:00
KITAITI Makoto c81b2dabbc
ruby : transcribe without GVL, accept more MemoryViews, Windows support, fix memory size report, improve document (#3775)
* 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
2026-05-07 06:28:18 +02:00
KITAITI Makoto 76684141a5
ruby : fix dangling pointers, memory leak, and SEGV on parallel transcription (#3715)
* 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]
2026-03-22 02:03:00 +09:00
KITAITI Makoto 30c5194c96
ruby : null-check (#3689)
* Introduce null-check to prevent SEGV

* Fix error message
2026-03-05 14:36:42 +09:00
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 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
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
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
Daniel Bevenius 2679bec6e0
ruby : add cleaning of library names in dependencies (#3241)
* 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.
2025-06-10 15:06:40 +02:00