@@ -1317,12 +1317,12 @@ static std::pair<int, int> test_gguf_set_kv(ggml_backend_dev_t dev, const unsign
13171317
13181318static std::pair<int , int > test_version_compatibility (const unsigned int seed) {
13191319 printf (" %s: testing GGUF version compatibility\n " , __func__);
1320-
1320+
13211321 int npass = 0 ;
13221322 int ntest = 0 ;
1323-
1323+
13241324 FILE * file_v3 = get_handcrafted_file (seed, HANDCRAFTED_DATA_SUCCESS);
1325-
1325+
13261326#ifdef _WIN32
13271327 if (!file_v3) {
13281328 printf (" failed to create tmpfile(), needs elevated privileges on Windows" );
@@ -1332,14 +1332,14 @@ static std::pair<int, int> test_version_compatibility(const unsigned int seed) {
13321332#else
13331333 GGML_ASSERT (file_v3);
13341334#endif
1335-
1335+
13361336 struct ggml_context * ctx = nullptr ;
13371337 struct gguf_init_params params = {
13381338 /* no_alloc =*/ false ,
13391339 /* ctx =*/ &ctx,
13401340 };
13411341 struct gguf_context * gguf_ctx = gguf_init_from_file_impl (file_v3, params);
1342-
1342+
13431343 printf (" %s: read_version_3: " , __func__);
13441344 if (gguf_ctx && gguf_get_version (gguf_ctx) == GGUF_VERSION) {
13451345 printf (" \033 [1;32mOK\033 [0m\n " );
@@ -1348,13 +1348,13 @@ static std::pair<int, int> test_version_compatibility(const unsigned int seed) {
13481348 printf (" \033 [1;31mFAIL\033 [0m\n " );
13491349 }
13501350 ntest++;
1351-
1351+
13521352 fclose (file_v3);
13531353 if (gguf_ctx) {
13541354 ggml_free (ctx);
13551355 gguf_free (gguf_ctx);
13561356 }
1357-
1357+
13581358 printf (" \n " );
13591359 return std::make_pair (npass, ntest);
13601360}
@@ -1363,16 +1363,16 @@ static std::pair<int, int> test_large_file_handling(ggml_backend_dev_t dev, cons
13631363 (void )seed;
13641364 ggml_backend_t backend = ggml_backend_dev_init (dev, nullptr );
13651365 printf (" %s: device=%s, backend=%s\n " , __func__, ggml_backend_dev_description (dev), ggml_backend_name (backend));
1366-
1366+
13671367 int npass = 0 ;
13681368 int ntest = 0 ;
1369-
1369+
13701370 struct gguf_context * gguf_ctx = gguf_init_empty ();
13711371 for (int i = 0 ; i < 1000 ; ++i) {
13721372 const std::string key = " large_test_key_" + std::to_string (i);
13731373 gguf_set_val_u32 (gguf_ctx, key.c_str (), i);
13741374 }
1375-
1375+
13761376 printf (" %s: large_kv_count: " , __func__);
13771377 if (gguf_get_n_kv (gguf_ctx) == 1000 ) {
13781378 printf (" \033 [1;32mOK\033 [0m\n " );
@@ -1381,7 +1381,7 @@ static std::pair<int, int> test_large_file_handling(ggml_backend_dev_t dev, cons
13811381 printf (" \033 [1;31mFAIL\033 [0m\n " );
13821382 }
13831383 ntest++;
1384-
1384+
13851385 FILE * file = tmpfile ();
13861386#ifdef _WIN32
13871387 if (!file) {
@@ -1394,15 +1394,15 @@ static std::pair<int, int> test_large_file_handling(ggml_backend_dev_t dev, cons
13941394#else
13951395 GGML_ASSERT (file);
13961396#endif
1397-
1397+
13981398 std::vector<int8_t > buf;
13991399 gguf_write_to_buf (gguf_ctx, buf, false );
14001400 GGML_ASSERT (fwrite (buf.data (), 1 , buf.size (), file) == buf.size ());
14011401 rewind (file);
1402-
1402+
14031403 struct gguf_init_params params = {/* no_alloc =*/ false , /* ctx =*/ nullptr };
14041404 struct gguf_context * gguf_ctx_read = gguf_init_from_file_impl (file, params);
1405-
1405+
14061406 printf (" %s: large_kv_roundtrip: " , __func__);
14071407 if (gguf_ctx_read && gguf_get_n_kv (gguf_ctx_read) == 1000 ) {
14081408 printf (" \033 [1;32mOK\033 [0m\n " );
@@ -1411,14 +1411,14 @@ static std::pair<int, int> test_large_file_handling(ggml_backend_dev_t dev, cons
14111411 printf (" \033 [1;31mFAIL\033 [0m\n " );
14121412 }
14131413 ntest++;
1414-
1414+
14151415 fclose (file);
14161416 gguf_free (gguf_ctx);
14171417 if (gguf_ctx_read) {
14181418 gguf_free (gguf_ctx_read);
14191419 }
14201420 ggml_backend_free (backend);
1421-
1421+
14221422 printf (" \n " );
14231423 return std::make_pair (npass, ntest);
14241424}
0 commit comments