react-native-executorch
Version:
An easy way to run AI models in react native with ExecuTorch
72 lines (71 loc) • 2.22 kB
JavaScript
;
import { MOONSHINE_TINY_ENCODER, MOONSHINE_TINY_DECODER, MOONSHINE_TOKENIZER, WHISPER_TINY_ENCODER, WHISPER_TINY_DECODER, WHISPER_TOKENIZER, WHISPER_TINY_MULTILINGUAL_ENCODER, WHISPER_TINY_MULTILINGUAL_DECODER, WHISPER_TINY_MULTILINGUAL_TOKENIZER } from './modelUrls';
export const SAMPLE_RATE = 16_000;
export const SECOND = SAMPLE_RATE;
export const HAMMING_DIST_THRESHOLD = 1;
const whisperTinyModelConfig = {
sources: {
encoder: WHISPER_TINY_ENCODER,
decoder: WHISPER_TINY_DECODER
},
tokenizer: {
source: WHISPER_TOKENIZER,
bos: 50257,
// FIXME: this is a placeholder and needs to be changed
eos: 50256 // FIXME: this is a placeholder and needs to be changed
},
isMultilingual: false
};
const moonshineTinyModelConfig = {
sources: {
encoder: MOONSHINE_TINY_ENCODER,
decoder: MOONSHINE_TINY_DECODER
},
tokenizer: {
source: MOONSHINE_TOKENIZER,
bos: 1,
// FIXME: this is a placeholder and needs to be changed
eos: 2 // FIXME: this is a placeholder and needs to be changed
},
isMultilingual: false
};
const whisperTinyMultilingualModelConfig = {
sources: {
encoder: WHISPER_TINY_MULTILINGUAL_ENCODER,
decoder: WHISPER_TINY_MULTILINGUAL_DECODER
},
tokenizer: {
source: WHISPER_TINY_MULTILINGUAL_TOKENIZER,
bos: 50258,
// FIXME: this is a placeholder and needs to be changed
eos: 50257 // FIXME: this is a placeholder and needs to be changed
},
isMultilingual: true
};
export const MODEL_CONFIGS = {
moonshine: moonshineTinyModelConfig,
whisper: whisperTinyModelConfig,
whisperMultilingual: whisperTinyMultilingualModelConfig
};
export const MODES = {
fast: {
windowSize: 5,
overlapSeconds: 1.2
},
balanced: {
windowSize: 12,
overlapSeconds: 2
},
quality: {
windowSize: 24,
overlapSeconds: 3
}
};
export const NUM_TOKENS_TO_TRIM = 3;
export let STREAMING_ACTION = /*#__PURE__*/function (STREAMING_ACTION) {
STREAMING_ACTION[STREAMING_ACTION["START"] = 0] = "START";
STREAMING_ACTION[STREAMING_ACTION["DATA"] = 1] = "DATA";
STREAMING_ACTION[STREAMING_ACTION["STOP"] = 2] = "STOP";
return STREAMING_ACTION;
}({});
//# sourceMappingURL=sttDefaults.js.map