Open BBC-Esq opened 9 months ago
I think whisper.cpp does not support batching. Do you know of any community implementation for batched whisper.cpp ?
The "tigros" link i gave you above, the guy names it "batch" but I'm not sure if it's "batch" in the same sense as you mean the word in a technical sense...
And apparently he uses the the "const-me/whisper" repository's approach...and just creates multiple instances though, which might be different technically than what you're referring to?
However, correct me if I'm wrong, but weren't you the one to implement batch processing with ctranslate2? I don't know of anyone else who did before you, and it'd been something I'd been looking for for awhile. WhisperX I guess kind of did it I guess...I know there was some discussion on faster-whisper about it, but I didn't think that he actually did it.
That's why I thought you could implement batch processing in whisper.cpp if it didn't already exist?
Upon further researching the issue...am I correct in understanding that you're referring to batch processing capabilities like this method within the ctranslate2 library:
Whisper::generate(const StorageView& features,
std::vector<std::vector<std::string>> prompts,
WhisperOptions options) {
const size_t batch_size = features.dim(0);
return post_batch<WhisperGenerationResult>(
[features = features.sync_copy(),
prompts = std::move(prompts),
options = std::move(options)]
(WhisperReplica& replica) mutable {
return replica.generate(std::move(features), prompts, options);
},
batch_size);
}
I believe that your program primarily harnesses the inherent batch processing capabilities of ctranslate2 in this manner in contrast to the faster-whisper
library. WhisperS2T sends an array whereas faster-whisper doesn't basically?
And you're wondering if whisper.cpp has something similar?
I did some further research regarding the whisper.cpp
library and here's what I found. Within the script itself named whisper.cpp
.
https://github.com/ggerganov/whisper.cpp/blob/master/whisper.cpp
I "believe" that it allows for batch processing in this snippet. I will first provide you with the portions from the "cpp" repository that pertain to batch processing...then, if I'm able, I'll locate any python bindings for whisper.cpp
that implement the batch processing feature...keep in mind that the python bindings I've found don't stay up to date as often as the cpp repository...Here goes:
There is one more chunk starting on line 4478 of whisper.cpp
and ending on line 5898 that I felt was too long to paste there. I'll try to paste for your convenient, if i can get them, any python bindings regarding the batch functionality of whisper.cpp
for you. Thanks!
This also seems to confirm that whisper.cpp supports batch processing like huggingface and ctranslate2 do....
One the announcement for version 1.5 it states that they support batching...
https://github.com/ggerganov/whisper.cpp/releases?q=batch&expanded=true
And these python bindings claim to support whisper.cpp
all the way to version 1.5.4:
https://github.com/abdeladim-s/pywhispercpp/releases/tag/v1.2.0
Note, the above bindings are NOT listed on whisper.cpp
repo for some reason...the only two listed are the following, which haven't been updated in quite awhile...
https://github.com/stlukey/whispercpp.py https://github.com/aarnphm/whispercpp
I don't know if this means that the owner of "abdeladim" just hasn't requested a community integration shoutout or what...so I wouldn't assume necessarily that his bindings aren't good...
If you're collecting backends, I'd be very interested in seeing whisper.cpp as a possible backend. Here are some links:
https://github.com/ggerganov/whisper.cpp https://github.com/abdeladim-s/pywhispercpp https://github.com/tigros/Whisperer https://github.com/Const-me/Whisper https://github.com/aarnphm/whispercpp