Skip to content

Commit ebcc589

Browse files
committed
refactor: add multilingual property to model config, refactor existing configs
1 parent 74b5269 commit ebcc589

1 file changed

Lines changed: 36 additions & 27 deletions

File tree

src/constants/sttDefaults.ts

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,41 @@ export interface ModelConfig {
2222
eos: number;
2323
special_char: string;
2424
};
25+
multilingual: boolean;
2526
}
2627

27-
export const MODEL_CONFIGS: { [key in 'moonshine' | 'whisper']: ModelConfig } =
28-
{
29-
moonshine: {
30-
sources: {
31-
encoder: MOONSHINE_TINY_ENCODER,
32-
decoder: MOONSHINE_TINY_DECODER,
33-
},
34-
tokenizer: {
35-
source: MOONSHINE_TOKENIZER,
36-
bos: 1,
37-
eos: 2,
38-
special_char: '\u2581',
39-
},
40-
},
41-
whisper: {
42-
sources: {
43-
encoder: WHISPER_TINY_ENCODER,
44-
decoder: WHISPER_TINY_DECODER,
45-
},
46-
tokenizer: {
47-
source: WHISPER_TOKENIZER,
48-
bos: 50257,
49-
eos: 50256,
50-
special_char: 'Ġ',
51-
},
52-
},
53-
};
28+
const whisperTinyModelConfig = {
29+
sources: {
30+
encoder: WHISPER_TINY_ENCODER,
31+
decoder: WHISPER_TINY_DECODER,
32+
},
33+
tokenizer: {
34+
source: WHISPER_TOKENIZER,
35+
bos: 50257,
36+
eos: 50256,
37+
special_char: 'Ġ',
38+
},
39+
multilingual: false,
40+
};
41+
42+
const moonshineTinyModelConfig = {
43+
sources: {
44+
encoder: MOONSHINE_TINY_ENCODER,
45+
decoder: MOONSHINE_TINY_DECODER,
46+
},
47+
tokenizer: {
48+
source: MOONSHINE_TOKENIZER,
49+
bos: 1,
50+
eos: 2,
51+
special_char: '\u2581',
52+
},
53+
multilingual: false,
54+
};
55+
56+
export const MODEL_CONFIGS: {
57+
[key in 'moonshine' | 'whisper' | 'whisperMultilingual']: ModelConfig;
58+
} = {
59+
moonshine: moonshineTinyModelConfig,
60+
whisper: whisperTinyModelConfig,
61+
whisperMultilingual: { ...whisperTinyModelConfig, multilingual: true },
62+
};

0 commit comments

Comments
 (0)