-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Added a bool fold_lowercase to whisper_context_params #2005
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
Open
ulatekh
wants to merge
5
commits into
ggml-org:master
Choose a base branch
from
ulatekh:fold-lowercase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−4
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
04923a9
Added a bool fold_lowercase to whisper_context_params.
ulatekh 6d57fac
Implemented a --model-fold-lc parameter in the main and command examp…
ulatekh f3fc0b3
Apply suggestions from code review
ulatekh db0d2fa
Blind checkin to hopefully resolve Java issues.
ulatekh 1802247
Fixed Java errors found by Visual Studio Code.
ulatekh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
bindings/java/src/main/java/io/github/ggerganov/whispercpp/model/WhisperModel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAheads.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.github.ggerganov.whispercpp.params; | ||
|
||
import com.sun.jna.*; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class WhisperAheads extends Structure { | ||
public long n_heads; | ||
public Pointer heads; | ||
|
||
@Override | ||
protected List<String> getFieldOrder() { | ||
return Arrays.asList("n_heads", "heads"); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAlignmentHeadsPreset.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.ggerganov.whispercpp.params; | ||
|
||
public enum WhisperAlignmentHeadsPreset { | ||
WHISPER_AHEADS_NONE, | ||
WHISPER_AHEADS_N_TOP_MOST, // All heads from the N-top-most text-layers | ||
WHISPER_AHEADS_CUSTOM, | ||
WHISPER_AHEADS_TINY_EN, | ||
WHISPER_AHEADS_TINY, | ||
WHISPER_AHEADS_BASE_EN, | ||
WHISPER_AHEADS_BASE, | ||
WHISPER_AHEADS_SMALL_EN, | ||
WHISPER_AHEADS_SMALL, | ||
WHISPER_AHEADS_MEDIUM_EN, | ||
WHISPER_AHEADS_MEDIUM, | ||
WHISPER_AHEADS_LARGE_V1, | ||
WHISPER_AHEADS_LARGE_V2, | ||
WHISPER_AHEADS_LARGE_V3 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -65,6 +65,7 @@ struct whisper_params { | |||||||||
bool no_timestamps = false; | ||||||||||
bool log_score = false; | ||||||||||
bool use_gpu = true; | ||||||||||
bool model_fold_lc = false; | ||||||||||
|
||||||||||
std::string language = "en"; | ||||||||||
std::string prompt; | ||||||||||
|
@@ -145,6 +146,7 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) { | |||||||||
else if (arg == "-pc" || arg == "--print-colors") { params.print_colors = true; } | ||||||||||
else if (arg == "-pp" || arg == "--print-progress") { params.print_progress = true; } | ||||||||||
else if (arg == "-nt" || arg == "--no-timestamps") { params.no_timestamps = true; } | ||||||||||
else if ( arg == "--model-fold-lc") { params.model_fold_lc = true; } | ||||||||||
else if (arg == "-l" || arg == "--language") { params.language = whisper_param_turn_lowercase(argv[++i]); } | ||||||||||
else if (arg == "-dl" || arg == "--detect-language") { params.detect_language = true; } | ||||||||||
else if ( arg == "--prompt") { params.prompt = argv[++i]; } | ||||||||||
|
@@ -205,6 +207,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para | |||||||||
fprintf(stderr, " -pc, --print-colors [%-7s] print colors\n", params.print_colors ? "true" : "false"); | ||||||||||
fprintf(stderr, " -pp, --print-progress [%-7s] print progress\n", params.print_progress ? "true" : "false"); | ||||||||||
fprintf(stderr, " -nt, --no-timestamps [%-7s] do not print timestamps\n", params.no_timestamps ? "true" : "false"); | ||||||||||
fprintf(stderr, " --model-fold-lc [%-7s] fold all model tokens to lowercase\n", params.model_fold_lc ? "true" : "false"); | ||||||||||
Comment on lines
209
to
+210
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
fprintf(stderr, " -l LANG, --language LANG [%-7s] spoken language ('auto' for auto-detect)\n", params.language.c_str()); | ||||||||||
fprintf(stderr, " -dl, --detect-language [%-7s] exit after automatically detecting language\n", params.detect_language ? "true" : "false"); | ||||||||||
fprintf(stderr, " --prompt PROMPT [%-7s] initial prompt (max n_text_ctx/2 tokens)\n", params.prompt.c_str()); | ||||||||||
|
@@ -893,6 +896,7 @@ int main(int argc, char ** argv) { | |||||||||
|
||||||||||
struct whisper_context_params cparams = whisper_context_default_params(); | ||||||||||
cparams.use_gpu = params.use_gpu; | ||||||||||
cparams.vocab_lc = params.model_fold_lc; | ||||||||||
|
||||||||||
if (!params.dtw.empty()) { | ||||||||||
cparams.dtw_token_timestamps = true; | ||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change name to
vocab_lc