To .exe
IVIiracle opened this issue · 6 comments
Хочу компилировать твой замечательный код, чтобы на выходе быть .exe файл со всеми зависимостями. Скажи как можно указать место, куда будет скачиваться модель whisper?
По умолчанию 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.
Спасибо большое, что все так детально пояснил. У меня получилось указать место для модели, а вот с компиляцией пока вопрос. Сам процесс проходит нормально, но итоговый файл запускается и сразу выключается. Может нужен графический интерфейс?
Вопрос, как в твоем коде поставить язык для модели whisper?
Вы можете установить язык с помощью параметра 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
Вы можете установить язык с помощью параметра
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, но главное, что получилось.
is there any update on this?
can it be converted to desktop app now?