mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-21 21:47:47 +00:00
262e865a70
* Use C++17 * Add test for Pathname of model * Make Whisper::Context#initialize accept Pathname * Add shorthand for pre-converted models * Update documents * Add headings to API section in README [skip ci] * Remove unused function * Don't care about no longer included file * Cosmetic fix * Use conditional get when get model files
65 lines
1.8 KiB
Ruby
65 lines
1.8 KiB
Ruby
require_relative "helper"
|
|
require "pathname"
|
|
|
|
class TestModel < TestBase
|
|
def test_model
|
|
whisper = Whisper::Context.new(MODEL)
|
|
assert_instance_of Whisper::Model, whisper.model
|
|
end
|
|
|
|
def test_attributes
|
|
whisper = Whisper::Context.new(MODEL)
|
|
model = whisper.model
|
|
|
|
assert_equal 51864, model.n_vocab
|
|
assert_equal 1500, model.n_audio_ctx
|
|
assert_equal 512, model.n_audio_state
|
|
assert_equal 8, model.n_audio_head
|
|
assert_equal 6, model.n_audio_layer
|
|
assert_equal 448, model.n_text_ctx
|
|
assert_equal 512, model.n_text_state
|
|
assert_equal 8, model.n_text_head
|
|
assert_equal 6, model.n_text_layer
|
|
assert_equal 80, model.n_mels
|
|
assert_equal 1, model.ftype
|
|
assert_equal "base", model.type
|
|
end
|
|
|
|
def test_gc
|
|
model = Whisper::Context.new(MODEL).model
|
|
GC.start
|
|
|
|
assert_equal 51864, model.n_vocab
|
|
assert_equal 1500, model.n_audio_ctx
|
|
assert_equal 512, model.n_audio_state
|
|
assert_equal 8, model.n_audio_head
|
|
assert_equal 6, model.n_audio_layer
|
|
assert_equal 448, model.n_text_ctx
|
|
assert_equal 512, model.n_text_state
|
|
assert_equal 8, model.n_text_head
|
|
assert_equal 6, model.n_text_layer
|
|
assert_equal 80, model.n_mels
|
|
assert_equal 1, model.ftype
|
|
assert_equal "base", model.type
|
|
end
|
|
|
|
def test_pathname
|
|
path = Pathname(MODEL)
|
|
whisper = Whisper::Context.new(path)
|
|
model = whisper.model
|
|
|
|
assert_equal 51864, model.n_vocab
|
|
assert_equal 1500, model.n_audio_ctx
|
|
assert_equal 512, model.n_audio_state
|
|
assert_equal 8, model.n_audio_head
|
|
assert_equal 6, model.n_audio_layer
|
|
assert_equal 448, model.n_text_ctx
|
|
assert_equal 512, model.n_text_state
|
|
assert_equal 8, model.n_text_head
|
|
assert_equal 6, model.n_text_layer
|
|
assert_equal 80, model.n_mels
|
|
assert_equal 1, model.ftype
|
|
assert_equal "base", model.type
|
|
end
|
|
end
|