Skip to content

Commit d979f2b

Browse files
tests : model metadata loading from huggingface (ggml-org#19796)
* Add model metadata loading from huggingface for use with other tests * Add incremental chunking instead of full redownload, fix caching issue and add warning when it fails * Add support for split models, load metadata from each individual split file, also avoid mmproj * Code cleanup, revert incremental downloading * Only compile when cpp-httplib has SSL support * Fix formatting
1 parent ecbcb7e commit d979f2b

4 files changed

Lines changed: 791 additions & 0 deletions

File tree

tests/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,21 @@ set(LLAMA_TEST_NAME test-mtmd-c-api)
257257
llama_build_and_test(test-mtmd-c-api.c)
258258
target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd)
259259

260+
# GGUF model data fetcher library for tests that need real model metadata
261+
# Only compile when cpp-httplib has SSL support (CPPHTTPLIB_OPENSSL_SUPPORT)
262+
if (TARGET cpp-httplib)
263+
get_target_property(_cpp_httplib_defs cpp-httplib INTERFACE_COMPILE_DEFINITIONS)
264+
if (_cpp_httplib_defs MATCHES "CPPHTTPLIB_OPENSSL_SUPPORT")
265+
add_library(gguf-model-data STATIC gguf-model-data.cpp)
266+
target_link_libraries(gguf-model-data PRIVATE common cpp-httplib)
267+
target_include_directories(gguf-model-data PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
268+
269+
add_executable(test-gguf-model-data test-gguf-model-data.cpp)
270+
target_link_libraries(test-gguf-model-data PRIVATE gguf-model-data common)
271+
llama_test(test-gguf-model-data LABEL "model")
272+
endif()
273+
endif()
274+
260275
# dummy executable - not installed
261276
get_filename_component(TEST_TARGET test-c.c NAME_WE)
262277
add_executable(${TEST_TARGET} test-c.c)

0 commit comments

Comments
 (0)