Skip to content

Commit 6a8ec36

Browse files
author
liuyang.marshall
committed
add some note
1 parent 376c9bd commit 6a8ec36

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/whisper.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5435,14 +5435,15 @@ int whisper_full_with_state(
54355435

54365436
result_all.clear();
54375437

5438-
if (n_samples > 0) {
5438+
if (n_samples > 0) {// mars-todo: 计算log mel spectrogram,结果保存在state->mel
54395439
// compute log mel spectrogram
54405440
if (whisper_pcm_to_mel_with_state(ctx, state, samples, n_samples, params.n_threads) != 0) {
54415441
WHISPER_LOG_ERROR("%s: failed to compute log mel spectrogram\n", __func__);
54425442
return -2;
54435443
}
54445444
}
54455445

5446+
// mars-todo: 语言检测
54465447
// auto-detect language if not specified
54475448
if (params.language == nullptr || strlen(params.language) == 0 || strcmp(params.language, "auto") == 0 || params.detect_language) {
54485449
std::vector<float> probs(whisper_lang_max_id() + 1, 0.0f);
@@ -5461,6 +5462,7 @@ int whisper_full_with_state(
54615462
}
54625463
}
54635464

5465+
// mars-todo: 怎么理解token?
54645466
if (params.token_timestamps) {
54655467
state->t_beg = 0;
54665468
state->t_last = 0;
@@ -5481,6 +5483,7 @@ int whisper_full_with_state(
54815483
return 0;
54825484
}
54835485

5486+
// mars-todo: temperatures怎么理解,作用是什么?
54845487
// a set of temperatures to use
54855488
// [ t0, t0 + delta, t0 + 2*delta, ..., < 1.0f + 1e-6f ]
54865489
std::vector<float> temperatures;
@@ -5494,7 +5497,7 @@ int whisper_full_with_state(
54945497

54955498
// initialize the decoders
54965499
int n_decoders = 1;
5497-
5500+
// mars-todo: 两种decoder策略的区别,如何选择?
54985501
switch (params.strategy) {
54995502
case WHISPER_SAMPLING_GREEDY:
55005503
{
@@ -5570,6 +5573,7 @@ int whisper_full_with_state(
55705573
// these tokens determine the task that will be performed
55715574
std::vector<whisper_token> prompt_init = { whisper_token_sot(ctx), };
55725575

5576+
// mars-todo: 多语言模型与非多语言模型区别?
55735577
if (whisper_is_multilingual(ctx)) {
55745578
const int lang_id = whisper_lang_id(params.language);
55755579
state->lang_id = lang_id;
@@ -6354,7 +6358,7 @@ int whisper_full_parallel(
63546358
const float * samples,
63556359
int n_samples,
63566360
int n_processors) {
6357-
if (n_processors == 1) {
6361+
if (n_processors == 1) {// mars-todo: 是如何指定使用多少个processor?
63586362
return whisper_full(ctx, params, samples, n_samples);
63596363
}
63606364
int ret = 0;

0 commit comments

Comments
 (0)