From 444349f4ec6fdc9d0d2bb3128add10da3c701a8a Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 11 Dec 2022 20:19:17 +0200 Subject: [PATCH] talk : make compatible with c++11 --- examples/talk.wasm/gpt-2.cpp | 14 ++++++-------- examples/talk/gpt-2.cpp | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/talk.wasm/gpt-2.cpp b/examples/talk.wasm/gpt-2.cpp index 0bffe72..3cdc2c2 100644 --- a/examples/talk.wasm/gpt-2.cpp +++ b/examples/talk.wasm/gpt-2.cpp @@ -325,10 +325,9 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab & // create the ggml context { - struct ggml_init_params params = { - .mem_size = ctx_size, - .mem_buffer = NULL, - }; + struct ggml_init_params params; + params.mem_size = ctx_size; + params.mem_buffer = NULL; model.ctx = ggml_init(params); if (!model.ctx) { @@ -529,10 +528,9 @@ bool gpt2_eval( } } - struct ggml_init_params params = { - .mem_size = buf_size, - .mem_buffer = buf, - }; + struct ggml_init_params params; + params.mem_size = buf_size; + params.mem_buffer = buf; struct ggml_context * ctx0 = ggml_init(params); struct ggml_cgraph gf = { .n_threads = n_threads }; diff --git a/examples/talk/gpt-2.cpp b/examples/talk/gpt-2.cpp index 1adb977..6ef2496 100644 --- a/examples/talk/gpt-2.cpp +++ b/examples/talk/gpt-2.cpp @@ -325,10 +325,9 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab & // create the ggml context { - struct ggml_init_params params = { - .mem_size = ctx_size, - .mem_buffer = NULL, - }; + struct ggml_init_params params; + params.mem_size = ctx_size; + params.mem_buffer = NULL; model.ctx = ggml_init(params); if (!model.ctx) { @@ -529,10 +528,9 @@ bool gpt2_eval( } } - struct ggml_init_params params = { - .mem_size = buf_size, - .mem_buffer = buf, - }; + struct ggml_init_params params; + params.mem_size = buf_size; + params.mem_buffer = buf; struct ggml_context * ctx0 = ggml_init(params); struct ggml_cgraph gf = { .n_threads = n_threads };