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

Update CUDA support and model versions #78

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set(USE_SYSTEM_CURL
CACHE STRING "Use system cURL")

if(LOCALVOCAL_WITH_CUDA)
message(STATUS "Building with CUDA support")
add_compile_definitions("LOCALVOCAL_WITH_CUDA")
endif()

Expand Down
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
},
"name": "obs-localvocal",
"version": "0.1.1",
"version": "0.2.0",
"author": "Roy Shilkrot",
"website": "https://github.com/occ-ai/obs-localvocal",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildWhispercpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if(WIN32)
endif(NOT DEFINED CUDA_TOOLKIT_ROOT_DIR)

set(WHISPER_ADDITIONAL_ENV "CUDAToolkit_ROOT=${CUDA_TOOLKIT_ROOT_DIR}")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_CUBLAS=ON -DWHISPER_OPENBLAS=OFF
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=OFF -DWHISPER_CUBLAS=ON -DWHISPER_OPENBLAS=OFF
-DCMAKE_GENERATOR_TOOLSET=cuda=${CUDA_TOOLKIT_ROOT_DIR})
else()
# Build with OpenBLAS
Expand Down
5 changes: 2 additions & 3 deletions src/model-utils/model-downloader-ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

#include <filesystem>

const std::string MODEL_BASE_PATH = "https://huggingface.co/ggerganov/whisper.cpp";
const std::string MODEL_PREFIX = "resolve/main/";
const std::string MODEL_BASE_PATH = "https://ggml.ggerganov.com/";

size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
Expand Down Expand Up @@ -143,7 +142,7 @@ void ModelDownloadWorker::download_model()
const std::string model_filename =
this->model_name.substr(this->model_name.find_last_of("/\\") + 1);

std::string model_url = MODEL_BASE_PATH + "/" + MODEL_PREFIX + model_filename;
std::string model_url = MODEL_BASE_PATH + model_filename;
obs_log(LOG_INFO, "Model URL: %s", model_url.c_str());

CURL *curl = curl_easy_init();
Expand Down
44 changes: 34 additions & 10 deletions src/transcription-filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ void transcription_filter_defaults(obs_data_t *s)
obs_data_set_default_int(s, "log_level", LOG_DEBUG);
obs_data_set_default_bool(s, "log_words", true);
obs_data_set_default_bool(s, "caption_to_stream", false);
obs_data_set_default_string(s, "whisper_model_path", "models/ggml-tiny.en.bin");
obs_data_set_default_string(s, "whisper_model_path",
"models/ggml-model-whisper-tiny.en.bin");
obs_data_set_default_string(s, "whisper_language_select", "en");
obs_data_set_default_string(s, "subtitle_sources", "none");
obs_data_set_default_bool(s, "step_by_step_processing", false);
Expand Down Expand Up @@ -754,15 +755,38 @@ obs_properties_t *transcription_filter_properties(void *data)
obs_properties_add_list(ppts, "whisper_model_path", MT_("whisper_model"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);

obs_property_list_add_string(whisper_models_list, "Tiny (Eng) 75Mb",
"models/ggml-tiny.en.bin");
obs_property_list_add_string(whisper_models_list, "Tiny 75Mb", "models/ggml-tiny.bin");
obs_property_list_add_string(whisper_models_list, "Base (Eng) 142Mb",
"models/ggml-base.en.bin");
obs_property_list_add_string(whisper_models_list, "Base 142Mb", "models/ggml-base.bin");
obs_property_list_add_string(whisper_models_list, "Small (Eng) 466Mb",
"models/ggml-small.en.bin");
obs_property_list_add_string(whisper_models_list, "Small 466Mb", "models/ggml-small.bin");
obs_property_list_add_string(whisper_models_list, "Base q5 57M",
"models/ggml-model-whisper-base-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Base 141M",
"models/ggml-model-whisper-base.bin");
obs_property_list_add_string(whisper_models_list, "Base (Eng) q5 57M",
"models/ggml-model-whisper-base.en-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Base (Eng) 141M",
"models/ggml-model-whisper-base.en.bin");
obs_property_list_add_string(whisper_models_list, "Large q5 1G",
"models/ggml-model-whisper-large-q5_0.bin");
obs_property_list_add_string(whisper_models_list, "Medium q5 514M",
"models/ggml-model-whisper-medium-q5_0.bin");
obs_property_list_add_string(whisper_models_list, "Medium (Eng) 514M",
"models/ggml-model-whisper-medium.en-q5_0.bin");
obs_property_list_add_string(whisper_models_list, "Small q5 181M",
"models/ggml-model-whisper-small-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Small 465M",
"models/ggml-model-whisper-small.bin");
obs_property_list_add_string(whisper_models_list, "Small (Eng) q5 181M",
"models/ggml-model-whisper-small.en-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Small (Eng) 465M",
"models/ggml-model-whisper-small.en.bin");
obs_property_list_add_string(whisper_models_list, "Tiny q5 31M",
"models/ggml-model-whisper-tiny-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Tiny 74M",
"models/ggml-model-whisper-tiny.bin");
obs_property_list_add_string(whisper_models_list, "Tiny (Eng) q5 31M",
"models/ggml-model-whisper-tiny.en-q5_1.bin");
obs_property_list_add_string(whisper_models_list, "Tiny (Eng) q8 42M",
"models/ggml-model-whisper-tiny.en-q8_0.bin");
obs_property_list_add_string(whisper_models_list, "Tiny (Eng) 74M",
"models/ggml-model-whisper-tiny.en.bin");
obs_property_list_add_string(whisper_models_list, "Load external model file",
"!!!external!!!");

Expand Down
4 changes: 3 additions & 1 deletion src/whisper-utils/whisper-processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ struct whisper_context *init_whisper_context(const std::string &model_path)
{
obs_log(LOG_INFO, "Loading whisper model from %s", model_path.c_str());

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
#ifdef LOCALVOCAL_WITH_CUDA
cparams.use_gpu = true;
obs_log(LOG_INFO, "Using GPU for inference, device %d", cparams.gpu_device);
#else
cparams.use_gpu = false;
obs_log(LOG_INFO, "Using CPU for inference");
#endif

#ifdef _WIN32
Expand Down
2 changes: 1 addition & 1 deletion vendor/curl
Submodule curl updated 353 files
Loading