]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
examples : fix warnings (#152)
authorRavindra Marella <redacted>
Sat, 13 May 2023 12:24:47 +0000 (17:54 +0530)
committerGitHub <redacted>
Sat, 13 May 2023 12:24:47 +0000 (15:24 +0300)
examples/CMakeLists.txt
examples/dolly-v2/main.cpp
examples/gpt-j/main.cpp
examples/gpt-neox/main.cpp
examples/mnist/main.cpp

index 8a8b9f71ad418a36174260511c7ec570d7a19468..ceca69e907d3591c9907d11f5265dd8c6382edc4 100644 (file)
@@ -1,3 +1,15 @@
+if (GGML_ALL_WARNINGS)
+  if (NOT MSVC)
+      set(cxx_flags
+          # TODO(marella): Add other warnings.
+          -Wunused-variable
+          -Wno-unused-function
+          -Wno-multichar
+      )
+      add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>")
+  endif()
+endif()
+
 add_library(common STATIC common.cpp)
 target_include_directories(common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
 
index f6279511a9d7b86e4b025cc83cb9184a3052e37f..76a29be74544a5e6e4b91bcaf15abfc4af05e8c7 100644 (file)
@@ -220,7 +220,6 @@ bool dollyv2_model_load(const std::string & fname, dollyv2_model & model, gpt_vo
 
         const int n_embd  = hparams.n_embd;
         const int n_layer = hparams.n_layer;
-        const int n_ctx   = hparams.n_ctx;
         const int n_vocab = hparams.n_vocab;
 
         model.layers.resize(n_layer);
@@ -303,7 +302,7 @@ bool dollyv2_model_load(const std::string & fname, dollyv2_model & model, gpt_vo
 
         const size_t memory_size = ggml_nbytes(model.memory_k) + ggml_nbytes(model.memory_v);
 
-        printf("%s: memory_size = %8.2f MB, n_mem = %lld\n", __func__, memory_size/1024.0/1024.0, n_mem);
+        printf("%s: memory_size = %8.2f MB, n_mem = %ld\n", __func__, memory_size/1024.0/1024.0, n_mem);
     }
 
     // load weights
index 1f65820076e7766a1b26bb2c840d0533007c9469..c3d2228bedc1c5166bbbeeedf4cd85d9a2d61958 100644 (file)
@@ -206,7 +206,6 @@ bool gptj_model_load(const std::string & fname, gptj_model & model, gpt_vocab &
 
         const int n_embd  = hparams.n_embd;
         const int n_layer = hparams.n_layer;
-        const int n_ctx   = hparams.n_ctx;
         const int n_vocab = hparams.n_vocab;
 
         model.layers.resize(n_layer);
@@ -391,8 +390,6 @@ bool gptj_eval(
     const int n_vocab = hparams.n_vocab;
     const int n_rot   = hparams.n_rot;
 
-    const int d_key = n_embd/n_head;
-
     static size_t buf_size = 256u*1024*1024;
     static void * buf = malloc(buf_size);
 
index 1f793039d83945d7d2c6a3c875275076f25e0f18..4b18ab2df17e7c040016e1c2b87a925a2d2f5378 100644 (file)
@@ -209,7 +209,6 @@ bool gpt_neox_model_load(const std::string & fname, gpt_neox_model & model, gpt_
 
         const int n_embd  = hparams.n_embd;
         const int n_layer = hparams.n_layer;
-        const int n_ctx   = hparams.n_ctx;
         const int n_vocab = hparams.n_vocab;
 
         model.layers.resize(n_layer);
@@ -289,7 +288,7 @@ bool gpt_neox_model_load(const std::string & fname, gpt_neox_model & model, gpt_
 
         const size_t memory_size = ggml_nbytes(model.memory_k) + ggml_nbytes(model.memory_v);
 
-        printf("%s: memory_size = %8.2f MB, n_mem = %lld\n", __func__, memory_size/1024.0/1024.0, n_mem);
+        printf("%s: memory_size = %8.2f MB, n_mem = %ld\n", __func__, memory_size/1024.0/1024.0, n_mem);
     }
 
     // load weights
index 8036aaf00e5bcf707de79a7a2f687a7036d1634e..70beb36e3374acde4a774c683bbeef6818b2cf57 100644 (file)
@@ -55,8 +55,6 @@ bool mnist_model_load(const std::string & fname, mnist_model & model) {
         }
     }
 
-    const ggml_type wtype2 = GGML_TYPE_F32;
-
     auto & ctx = model.ctx;
     size_t ctx_size = 0;
 
@@ -206,7 +204,6 @@ int main(int argc, char ** argv) {
         fprintf(stderr, "Usage: %s models/mnist/ggml-model-f32.bin models/mnist/t10k-images.idx3-ubyte\n", argv[0]);
         exit(0);
     }
-    const int64_t t_main_start_us = ggml_time_us();
 
     mnist_hparams params;
     int64_t t_load_us = 0;