Repository navigation
Replies: 2 comments
|
The empty registry in your follow-up points to backend registration, rather than the model file. In the current source, the registry constructor registers the CPU backend under A simpler baseline is to let CMake build the library and link its cmake_minimum_required(VERSION 3.16)
project(whisper_embed LANGUAGES C CXX)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(GGML_BACKEND_DL OFF CACHE BOOL "" FORCE)
set(GGML_CPU ON CACHE BOOL "" FORCE)
set(GGML_METAL OFF CACHE BOOL "" FORCE)
set(GGML_BLAS OFF CACHE BOOL "" FORCE)
set(WHISPER_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(WHISPER_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(WHISPER_BUILD_SERVER OFF CACHE BOOL "" FORCE)
add_subdirectory(whisper.cpp)
add_executable(myapp main.cpp)
target_link_libraries(myapp PRIVATE whisper)Start with a diagnostic #include "whisper.h"
#include "ggml-backend.h"
#include <cstdio>
int main() {
std::printf("%s\n", whisper_print_system_info());
auto cpu = ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU);
std::printf("devices=%zu cpu=%s\n", ggml_backend_dev_count(), cpu ? ggml_backend_dev_name(cpu) : "NONE");
return cpu ? 0 : 1;
}For Visual Studio 2022 on x64 Windows, generate and build with: cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release --target myapp
.\build\Release\myapp.exeAdjust the generator/architecture if your VS installation differs. Once that reports a CPU device, replace the diagnostic with your model-loading code. This baseline uses static libraries and disables dynamically loaded backends, so there are no backend DLLs to locate. I built and ran this exact CMake/main pair on macOS arm64 against the linked revision; it printed |



Uh oh!
There was an error while loading. Please reload this page.
I tried to directly copy/paste and then add the c/cpp and header files to my visual studio project, added the preprocessor directives, but every time I build it seems something is missing or otherwise not working.
Am I going about this the wrong way? I'm afraid I am not very good with cmake, but am willing to follow direct instruction and get background knowledge
All reactions