jhj0517 / Whisper-WebUI

A Web UI for easy subtitle using whisper model.
Apache License 2.0
1.05k stars 160 forks source link

How to select the Whisper implementation? #226

Open xu2k opened 1 month ago

xu2k commented 1 month ago

Which OS are you using?

Whisper를 insanely fast whisper 모델로 바꾸고 싶습니다.

어떻게 바꿔야 하나요?

또한 타임라인에 문장하나마다 너무 길게 나오는데 이런 경우는 어떻게 해결 해야 하나요?

3 00:00:12,279 --> 00:00:27,199 CoffeeZilla decided it was not just time to end Jay's crypto schemes, but his entire career. the largest giveaway scam in history and the crazy thing is that it's still going on right now as we

이런식으로 너무 길게 나오네요 한번에..

jhj0517 commented 1 month ago

@xu2k 님 안녕하세요.

Whisper를 insanely fast whisper 모델로 바꾸고 싶습니다.

CLI 매개 변수를 이용하여 변경하실 수 있습니다.

예)

python app.py --whisper_type insanely-fast-whisper

user-start-webui.bat 과 같은 배치 파일을 이용해 WebUI를 실행 중이신 경우, 배치 파일 상단의 set 매개변수 부분을 수정하여 해당 매개변수를 수정하실 수 있습니다.

예)

//~  ..
set WHISPER_TYPE=insanely_fast_whisper
//~  ..

+) 배치 파일을 통한 매개변수가 적용 되지 않는 버그를 발견하여 #227 에서 수정하였습니다.

매개 변수들의 종류는 Wiki 에서 확인하실 수 있습니다.

또한 타임라인에 문장하나마다 너무 길게 나오는데 이런 경우는 어떻게 해결 해야 하나요?

위스퍼 모델에 각 세그먼트 ( 최소 단위 구간 ) 의 길이를 조절할 수 있는 변수 같은 것은 없습니다만, 제가 아는 한 최선의 방법은 VAD 를 이용하는 것입니다. 예를 들어 Minimum Silence Duration (ms) 를 줄이고 Speech Padding (ms) 을 늘리는 것으로 세그먼트를 그나마 짧게 조절할 수 있습니다.

예시 세팅) image

이러한 방법은 음량이 작은 부분을 완전 묵음 처리 후 각 구간에 임의의 간격을 주어서 오디오를 전처리 하는 것으로, 위스퍼 모델에 직접적인 영향을 주는 것은 아니기에 한계점이 있습니다.

무언가 안되는 것이 있거나 묻고 싶은 것이 있으시다면 자유롭게 질문해주세요!

xu2k commented 1 month ago

답변 고맙습니다. 알려주신 대로 수정해서 insanely fast whisper로 바꿨습니다.

https://colab.research.google.com/drive/1qeTSvi7Bt_5RMm88ipW4fkcsMOKlDDss?usp=sharing#scrollTo=IuL5nGTIWYTY

여기서 사용하던건 문장이 잘려서 나와서 좋았는데 다른 버젼들의 whisper들은 한번에 문장이 타임라인 하나 구간에 다 넣어져서 아쉽네요 ㅠ

xu2k commented 1 month ago

그리고

Error transcribing file: cannot access local variable 'logprobs' where it is not associated with a value Traceback (most recent call last): File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\queueing.py", line 527, in process_events response = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\route_utils.py", line 270, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1856, in process_api data = await self.postprocess_data(fn_index, result["prediction"], state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1634, in postprocess_data self.validate_outputs(fn_index, predictions) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1610, in validate_outputs raise ValueError( ValueError: An event handler (transcribe_youtube) didn't receive enough output values (needed: 2, received: 1). Wanted outputs: [<gradio.components.textbox.Textbox object at 0x00000192CE313A70>, <gradio.templates.Files object at 0x00000192CE313AA0>] Received outputs: [None]

자막 추출 중 이러한 오류가 발생하는데 무슨 문제인지 혹시 아시나요?

jhj0517 commented 1 month ago

@xu2k 최신 버전의 WebUI 로 테스트 했을 때 버그 재현이 안 되고 있는데요, 최신 버전의 WebUI 로 다시 시도해보시겠어요?

git 으로 WebUI 를 업데이트 하실 수 있습니다.

git pull origin master
xu2k commented 1 month ago

네ㅠㅠ 업데이트 하고 해봤는데도 똑같네요

Error transcribing file: cannot access local variable 'logprobs' where it is not associated with a value Traceback (most recent call last): File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\queueing.py", line 527, in process_events response = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\route_utils.py", line 270, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1856, in process_api data = await self.postprocess_data(fn_index, result["prediction"], state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1634, in postprocess_data self.validate_outputs(fn_index, predictions) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sgwli\OneDrive\바탕 화면\Whisper-WebUI-Windows\Whisper-WebUI\venv\Lib\site-packages\gradio\blocks.py", line 1610, in validate_outputs raise ValueError( ValueError: An event handler (transcribe_youtube) didn't receive enough output values (needed: 2, received: 1). Wanted outputs: [<gradio.components.textbox.Textbox object at 0x0000021CE4E037D0>, <gradio.templates.Files object at 0x0000021CE4E03800>] Received outputs: [None]

timtjtim commented 1 month ago

I'm also getting this error on master with insanely_fast_whisper and model tiny

jhj0517 commented 1 month ago

@timtjtim @xu2k

This is due to a transformers version incompatibility. You can fix it by downgrading transformers to 4.42.3.

  1. First, activate the venv in the terminal

    C:\Path_to_WebUI>venv\Scripts\activate
  2. You should see the (venv) in front of the terminal after this

    (venv) C:\Path_to_WebUI>
  3. In this state, install transformers==4.42.3

    pip install -U transformers==4.42.3

transformers 패키지를 4.42.3 버전으로 다운그레이드 하는 것으로 해결할 수 있습니다. venv 를 활성화 하신 후에 transformers 패키지를 재설치 하셔야 합니다.

  1. 터미널을 열고 venv 활성화 하기

    C:\Path_to_WebUI>venv\Scripts\activate
  2. 정상적으로 활성화 되었다면 터미널 앞단에 (venv) 가 보여야 합니다.

    (venv) C:\Path_to_WebUI>
  3. 활성화 된 상태에서 transformers==4.42.3 설치하기

    pip install -U transformers==4.42.3