Spaces:
Sleeping
Sleeping
ruby : refine HTTP cache feature (#3109)
Browse files* Use cache file when model host doesn't support if-modified-since
* Update gem date
* Revert "ruby : ignore "Downloading" output in test_log_suppress (#3106)"
This reverts commit edbd4cb7f526897b48bf396e6cf3fccc3d74b378.
bindings/ruby/lib/whisper/model/uri.rb
CHANGED
|
@@ -55,6 +55,8 @@ module Whisper
|
|
| 55 |
when Net::HTTPNotModified
|
| 56 |
# noop
|
| 57 |
when Net::HTTPOK
|
|
|
|
|
|
|
| 58 |
download response
|
| 59 |
when Net::HTTPRedirection
|
| 60 |
request URI(response["location"]), headers
|
|
|
|
| 55 |
when Net::HTTPNotModified
|
| 56 |
# noop
|
| 57 |
when Net::HTTPOK
|
| 58 |
+
return if !response.key?("last-modified") && cache_path.exist?
|
| 59 |
+
|
| 60 |
download response
|
| 61 |
when Net::HTTPRedirection
|
| 62 |
request URI(response["location"]), headers
|
bindings/ruby/tests/test_whisper.rb
CHANGED
|
@@ -118,18 +118,7 @@ class TestWhisper < TestBase
|
|
| 118 |
dev = StringIO.new("")
|
| 119 |
$stderr = dev
|
| 120 |
Whisper::Context.new("base.en")
|
| 121 |
-
|
| 122 |
-
# Filter out any lines starting with "Downloading" or containing only dots.
|
| 123 |
-
# The reason for this is that I think the recent migration to Huggingface
|
| 124 |
-
# Xet might have changed the downloading behavior. There is now a redirect
|
| 125 |
-
# to a different URL, which causes the download to be retried even if the
|
| 126 |
-
# file is already downloaded.
|
| 127 |
-
# TODO(danbev) Remove this when a proper fix is in place.
|
| 128 |
-
filtered_output = dev.string.lines.reject do |line|
|
| 129 |
-
line.start_with?("Downloading") || line.strip =~ /^\.+$/
|
| 130 |
-
end.join
|
| 131 |
-
|
| 132 |
-
assert_empty filtered_output, "Expected no output, but got: #{filtered_output.inspect}"
|
| 133 |
ensure
|
| 134 |
$stderr = stderr
|
| 135 |
end
|
|
|
|
| 118 |
dev = StringIO.new("")
|
| 119 |
$stderr = dev
|
| 120 |
Whisper::Context.new("base.en")
|
| 121 |
+
assert_empty dev.string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
ensure
|
| 123 |
$stderr = stderr
|
| 124 |
end
|
bindings/ruby/whispercpp.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
| 4 |
s.name = "whispercpp"
|
| 5 |
s.authors = ["Georgi Gerganov", "Todd A. Fisher"]
|
| 6 |
s.version = '1.3.2'
|
| 7 |
-
s.date = '2025-
|
| 8 |
s.description = %q{High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model via Ruby}
|
| 9 |
s.email = 'todd.fisher@gmail.com'
|
| 10 |
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
|
|
|
| 4 |
s.name = "whispercpp"
|
| 5 |
s.authors = ["Georgi Gerganov", "Todd A. Fisher"]
|
| 6 |
s.version = '1.3.2'
|
| 7 |
+
s.date = '2025-05-01'
|
| 8 |
s.description = %q{High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model via Ruby}
|
| 9 |
s.email = 'todd.fisher@gmail.com'
|
| 10 |
s.extra_rdoc_files = ['LICENSE', 'README.md']
|