Skip to content

Commit

Permalink
Blind checkin to hopefully resolve Java issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulatekh committed Apr 9, 2024
1 parent f3fc0b3 commit db0d2fa
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
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");
}
}
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,26 @@ public WhisperContextParams(Pointer p) {
/** Use GPU for inference Number (default = true) */
public CBool use_gpu;

/** CUDA device */
public int gpu_device;

/** Fold language tokens to lowercase */
public CBool vocab_lc;

public CBool dtw_token_timestamps;
public WhisperAlignmentHeadsPreset dtw_aheads_preset;
public int dtw_n_top;
public WhisperAheads dtw_aheads;
public long dtw_mem_size;

/** Use GPU for inference Number (default = true) */
public void useGpu(boolean enable) {
use_gpu = enable ? CBool.TRUE : CBool.FALSE;
}

@Override
protected List<String> getFieldOrder() {
return Arrays.asList("use_gpu");
return Arrays.asList("use_gpu", "gpu_device", "vocab_lc", "dtw_token_timestamps", "dtw_aheads_preset",
"dtw_n_top", "dtw_aheads", "dtw_mem_size");
}
}
2 changes: 1 addition & 1 deletion whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3380,7 +3380,7 @@ struct whisper_context_params whisper_context_default_params() {
struct whisper_context_params result = {
/*.use_gpu =*/ true,
/*.gpu_device =*/ 0,
/*.fold_lowercase =*/ false,
/*.vocab_lc =*/ false,
/*.dtw_token_timestamps =*/ false,
/*.dtw_aheads_preset =*/ WHISPER_AHEADS_NONE,
/*.dtw_n_top =*/ -1,
Expand Down

0 comments on commit db0d2fa

Please sign in to comment.