Blair-Johnson / batch-whisper

Batch Support for OpenAI Whisper
MIT License
82 stars 21 forks source link

initial_prompt influences transciption result wrongly #10

Open chesha1 opened 1 year ago

chesha1 commented 1 year ago

When using initial prompts, result of batch-whisper is different from official whisper and it will also lose the first few words of the reslut. That is,

  1. whisper without initial prompt: result["text"] = 'abcdefg' result["segments"][0]["text"] = 'abcdefg'
  2. whisper with initial prompt: result["text"] = 'abcdefg' result["segments"][0]["text"] = 'abc, defg'
  3. batch-whisper without initial prompt: same with 1
  4. batch-whisper with initial prompt: result["text"] = 'bcdefg' result["segments"][0]["text"] = 'abcdefg'

Part of codes are below:

    audio_list = list()
    for k in range(batch_size):
        audio_list.append(load_audio(path + file_list[idx + k], sr=16000))
    prompt = ["以下是普通话的句子。"] * batch_size
    result = model.transcribe(audio_list, language='zh', task='transcribe', fp16=False,
                              initial_prompt=prompt)