Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To .exe #36

Open
IVIiracle opened this issue Oct 3, 2023 · 6 comments
Open

To .exe #36

IVIiracle opened this issue Oct 3, 2023 · 6 comments

Comments

@IVIiracle
Copy link

Хочу компилировать твой замечательный код, чтобы на выходе быть .exe файл со всеми зависимостями. Скажи как можно указать место, куда будет скачиваться модель whisper?

@davabase
Copy link
Owner

davabase commented Oct 3, 2023

По умолчанию whisper.load_model(model) будет помещать модели в папку кэша, ~/.cache/whisper в Linux и Mac и C:\Users\USER\.cache\whisper в Windows. Вам не нужно ничего делать, модели будут загружены в эту папку, когда будет вызвана функция load_model.

Вы можете указать каталог для загрузки модели, используя параметр download_root:

whisper.load_model(model, download_root='download/models/here')

Теперь модели будут загружаться в указанный каталог.

Если вы хотите загрузить уже загруженную модель, вы можете передать путь к файлу контрольной точки вместо имени модели:

whisper.load_model('path/to/base.pt')

В моем проекте transcriber_app я использую cx_Freeze, чтобы упаковать программу в exe. Вы можете посмотреть скрипт настройки в качестве примера того, как использовать cx_Freeze, но это для графического приложения, а не для консольной программы. cx_Freeze будет упаковывать все зависимости Python вместе с исполняемым файлом Python в exe, но учтите, что версия PyTorch для CUDA занимает более гигабайта, поэтому exe-файл будет большим.


By default whisper.load_model(model) will put the models in a cache folder, ~/.cache/whisper on Linux and Mac and C:\Users\USER\.cache\whisper on Windows. You do not have to do anything, the models will be downloaded to this folder when the load_model is called.

You can specify which directory to download the model to by using the download_root parameter:

whisper.load_model(model, download_root='download/models/here')

Now the models will be downloaded to the specified directory.

If you want to load an already downloaded model you can pass the path to the checkpoint file instead of a model name:

whisper.load_model('path/to/base.pt')

In my transcriber_app project I use cx_Freeze to package the program as an exe. You can see the setup script used as an example of how to use cx_Freeze but this is for a GUI app, not a console program. cx_Freeze will package all the python dependencies along with the python executable into an exe, but beware the CUDA version of PyTorch is over a gigabyte in size so the exe will be large.

@IVIiracle
Copy link
Author

Спасибо большое, что все так детально пояснил. У меня получилось указать место для модели, а вот с компиляцией пока вопрос. Сам процесс проходит нормально, но итоговый файл запускается и сразу выключается. Может нужен графический интерфейс?

Вопрос, как в твоем коде поставить язык для модели whisper?

@davabase
Copy link
Owner

davabase commented Oct 7, 2023

Вы можете установить язык с помощью параметра language в функции transcribe:

 result = audio_model.transcribe(temp_file, fp16=torch.cuda.is_available(), language="ru")

Список доступных языков можно найти здесь: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10


You can set the language with the language parameter in the transcribe function:

 result = audio_model.transcribe(temp_file, fp16=torch.cuda.is_available(), language="ru")

The list of available languages is here: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10

@IVIiracle
Copy link
Author

Вы можете установить язык с помощью параметра language в функции transcribe:

 result = audio_model.transcribe(temp_file, fp16=torch.cuda.is_available(), language="ru")

Список доступных языков можно найти здесь: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10

You can set the language with the language parameter in the transcribe function:

 result = audio_model.transcribe(temp_file, fp16=torch.cuda.is_available(), language="ru")

The list of available languages is here: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L10

Спасибо большое, все получилось. У меня вышло компилировать лишь с помощью Nuitka, но главное, что получилось.

@olawalejuwonm
Copy link

is there any update on this?

@olawalejuwonm
Copy link

can it be converted to desktop app now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants