Skip to content

ruby : refine HTTP cache feature #3109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bindings/ruby/lib/whisper/model/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def request(uri, headers)
when Net::HTTPNotModified
# noop
when Net::HTTPOK
return if !response.key?("last-modified") && cache_path.exist?

download response
when Net::HTTPRedirection
request URI(response["location"]), headers
Expand Down
13 changes: 1 addition & 12 deletions bindings/ruby/tests/test_whisper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,7 @@ def test_log_suppress
dev = StringIO.new("")
$stderr = dev
Whisper::Context.new("base.en")

# Filter out any lines starting with "Downloading" or containing only dots.
# The reason for this is that I think the recent migration to Huggingface
# Xet might have changed the downloading behavior. There is now a redirect
# to a different URL, which causes the download to be retried even if the
# file is already downloaded.
# TODO(danbev) Remove this when a proper fix is in place.
filtered_output = dev.string.lines.reject do |line|
line.start_with?("Downloading") || line.strip =~ /^\.+$/
end.join

assert_empty filtered_output, "Expected no output, but got: #{filtered_output.inspect}"
assert_empty dev.string
ensure
$stderr = stderr
end
Expand Down
2 changes: 1 addition & 1 deletion bindings/ruby/whispercpp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Gem::Specification.new do |s|
s.name = "whispercpp"
s.authors = ["Georgi Gerganov", "Todd A. Fisher"]
s.version = '1.3.2'
s.date = '2025-04-25'
s.date = '2025-05-01'
s.description = %q{High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model via Ruby}
s.email = '[email protected]'
s.extra_rdoc_files = ['LICENSE', 'README.md']
Expand Down
Loading