OpenAi whisper transcription workflow.

Questions and answers on how to get the most out of FFAStrans
Conniver
Posts: 36
Joined: Thu Jan 12, 2023 8:32 am

OpenAi whisper transcription workflow.

Post by Conniver »

I'm trying to make a workflow to transcribe videos, and generate a srt.

Made a Command executor to run whisper, but it never executes whisper.

Tried two different inputs to the Command executor

Code: Select all

%comspec% /C "whisper "%s_source%" --model tiny --language no --output_format srt"
witch yields the result:
Process exited with error code: 1 ('whisper' is not recognized as an internal or external command,
operable program or batch file.
)
the other is:

Code: Select all

whisper "%s_source%" --model tiny --language no --output_format srt
This gives success, but does not run whisper.
Executing Dos command: whisper "D:\SVG.wav" --model tiny --language no --output_format srt
running

Code: Select all

whisper "D:\SVG.wav" --model tiny --language no --output_format srt
in "cmd" works

I'm guessing I'm missing some basic understanding how the Command executor works.


If anyone is interested in using OpenAi whisper on windows 10, I used these resources.

https://github.com/openai/whisper
https://www.assemblyai.com/blog/how-to- ... on-model/
https://phoenixnap.com/kb/install-pip-windows

Or if you just want to use it with GUI (on windows, mac os or liunx) use this.
https://github.com/chidiwilliams/buzz
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: OpenAi whisper transcription workflow.

Post by emcodem »

Aye,
i guess you need to make sure that the paths are correct, e.g. just write the full path to your executeable "whisper.exe" or whatever it is.
What happens when you write "whisper" on a commandline as logged in user is that the system searches all "paths" that are stored in the "PATH" system environment variable and sees if it finds a matching executeable (.exe, .cmd, .bat).
The "PATH" Variable can be altered for the whole system or just for the logged in user which is what i suspect for you: the "PATH" variable only contains the path to whisper.exe for your logged in user but not for the whole system BUT you execute FFAStrans as a service using the "System" user probably.

So basically either you make sure that the path to your .exe is in PATH for the whole system OR you just provide the full path to the .exe.

https://docs.oracle.com/en/database/ora ... 7EC53807D0
emcodem, wrapping since 2009 you got the rhyme?
Conniver
Posts: 36
Joined: Thu Jan 12, 2023 8:32 am

Re: OpenAi whisper transcription workflow.

Post by Conniver »

I can't get it to work,
I have the path to both Python, and Python\Scripts (where whisper is located) in System Variables.

whisper have an whisper.exe file in Python\Scripts, but running this does not work, it runs, but not as intended.
Process exited with error code: 1 (Traceback (most recent call last):
File "c:\Program Files\Python310\Scripts\whisper-script.py", line 33, in <module>
sys.exit(load_entry_point('openai-whisper==20230124', 'console_scripts', 'whisper')())
File "c:\Program Files\Python310\Scripts\whisper-script.py", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "C:\Program Files\Python310\lib\importlib\metadata\__init__.py", line 919, in distribution
return Distribution.from_name(distribution_name)
File "C:\Program Files\Python310\lib\importlib\metadata\__init__.py", line 518, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for openai-whisper
)
While writing the post, and after several hours of trial and error, I realized I have to restart FFastrans for it to update the correct %Path%.

But I still get this error though.
Process exited with error code: 1 (Traceback (most recent call last):
File "C:\Program Files\Python310\Scripts\whisper-script.py", line 33, in <module>
sys.exit(load_entry_point('openai-whisper==20230124', 'console_scripts', 'whisper')())
File "C:\Program Files\Python310\Scripts\whisper-script.py", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "C:\Program Files\Python310\lib\importlib\metadata\__init__.py", line 919, in distribution
return Distribution.from_name(distribution_name)
File "C:\Program Files\Python310\lib\importlib\metadata\__init__.py", line 518, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for openai-whisper
So still confused why it works when used in cmd window, but not in FFmpeg.
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: OpenAi whisper transcription workflow.

Post by emcodem »

Well obviously it is missing sone py library. That can have py install specific reasons as well as path and cwd.
Best would be if whisper.exe was compiled as a self contained portaple package that has everything it needs inside. I do that usually using py2exe.

Do you run ffastrans as service?
If yes, try stopping the service and see if it works when ffastrans runs as application.

Also, you can try a cd command before executing the exe e.g. Prepend
cd c:\samepath &
In the commdline proc, where samepath is the currend directory you are in when executing it manually on cmd.

Just to be clear, this is the "cwd" (current working directory).
cwd.png
cwd.png (19.15 KiB) Viewed 5131 times
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: OpenAi whisper transcription workflow.

Post by admin »

HI Conniver,

I would try Whisper.cpp if I was you. I tried it very successfully with the command executor. It's just a simple exe file and no need for any python complexity.

https://github.com/ggerganov/whisper.cpp/releases

-steinar
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: OpenAi whisper transcription workflow.

Post by emcodem »

Adding link to standalone (non python) gpu version.
https://github.com/Const-me/Whisper
emcodem, wrapping since 2009 you got the rhyme?
Julian
Posts: 4
Joined: Tue Jul 07, 2020 9:56 pm

Re: OpenAi whisper transcription workflow.

Post by Julian »

I actually got it to work Conniver by following your step and the tip encodem gave:

Code: Select all

%comspec% /c C:\Users\SRV\AppData\Local\Programs\Python\Python39\Scripts\whisper.exe "%s_original_full%" --fp16=False --language nl --output_format txt --output_dir Z:\SPEECH_TO_TEXT\OUTPUT
The main difference I spotted in your WF is you use "%s_source%" and I used: "%s_original_full%"
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: OpenAi whisper transcription workflow.

Post by emcodem »

i guess the main difference is that @Julian runs ffastrans as application while Conniver as Service ;-)
Honestly, i would not recommend going productive with an unpackaged python installation (when not running in container).
I would always package the stuff into an executeable like Mr. Purfview does for faster-whisper here:
https://github.com/Purfview/whisper-sta ... /issues/16

The main problem with the original whisper project is their use of pytorch which seems to require special attention when packaging. But as i dont use original whisper because far too slow, i don't know for sure :D
emcodem, wrapping since 2009 you got the rhyme?
Julian
Posts: 4
Joined: Tue Jul 07, 2020 9:56 pm

Re: OpenAi whisper transcription workflow.

Post by Julian »

You are correct Emcodem, I run as application.

Thank you for the Mr. Purfview git, works even better!
taner
Posts: 204
Joined: Sun Jun 19, 2016 6:36 pm

Re: OpenAi whisper transcription workflow.

Post by taner »

i hate pytorch.
and i learned in the last months that i hate every application that start with: py

apart from that.
@emcodem: thanks for link!
this week i switched over to faster-whisper.
much faster than original whisper, less vram requirements.
great.
good to know that there is already a windows executable.
and faster-whisper is more reliable than https://github.com/Const-me/Whisper.
i mean...https://github.com/Const-me/Whisper is fast too but often repeats a sentence over and over over.
Post Reply