]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
gpt-neox : fix ctx size calculation (#228)
authorklosax <redacted>
Wed, 7 Jun 2023 16:15:50 +0000 (18:15 +0200)
committerGitHub <redacted>
Wed, 7 Jun 2023 16:15:50 +0000 (19:15 +0300)
examples/gpt-neox/main.cpp

index a53f98d589c9e4037d381b29dfff5ea7f8751407..2910da737311db0bde688ae6794630a1ee6ef288 100644 (file)
@@ -156,10 +156,10 @@ bool gpt_neox_model_load(const std::string & fname, gpt_neox_model & model, gpt_
     {
         const auto & hparams = model.hparams;
 
-        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;
+        const size_t n_embd  = hparams.n_embd;
+        const size_t n_layer = hparams.n_layer;
+        const size_t n_ctx   = hparams.n_ctx;
+        const size_t n_vocab = hparams.n_vocab;
 
         ctx_size += n_embd*ggml_type_sizef(GGML_TYPE_F32); // ln_f_g
         ctx_size += n_embd*ggml_type_sizef(GGML_TYPE_F32); // ln_f_b
@@ -190,7 +190,7 @@ bool gpt_neox_model_load(const std::string & fname, gpt_neox_model & model, gpt_
         ctx_size += n_ctx*n_layer*n_embd*ggml_type_sizef(GGML_TYPE_F32); // memory_k
         ctx_size += n_ctx*n_layer*n_embd*ggml_type_sizef(GGML_TYPE_F32); // memory_v
 
-        ctx_size += (6 + 16*n_layer)*512; // object overhead
+        ctx_size += (6 + 16*n_layer)*1024; // object overhead
 
         printf("%s: ggml ctx size = %6.2f MB\n", __func__, ctx_size/(1024.0*1024.0));
     }
@@ -806,4 +806,4 @@ int main(int argc, char ** argv) {
     ggml_free(model.ctx);
 
     return 0;
-}
\ No newline at end of file
+}