Spaces:
Sleeping
Sleeping
talk : make compatible with c++11
Browse files- examples/talk.wasm/gpt-2.cpp +6 -8
- examples/talk/gpt-2.cpp +6 -8
examples/talk.wasm/gpt-2.cpp
CHANGED
|
@@ -325,10 +325,9 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab &
|
|
| 325 |
|
| 326 |
// create the ggml context
|
| 327 |
{
|
| 328 |
-
struct ggml_init_params params
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
};
|
| 332 |
|
| 333 |
model.ctx = ggml_init(params);
|
| 334 |
if (!model.ctx) {
|
|
@@ -529,10 +528,9 @@ bool gpt2_eval(
|
|
| 529 |
}
|
| 530 |
}
|
| 531 |
|
| 532 |
-
struct ggml_init_params params
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
};
|
| 536 |
|
| 537 |
struct ggml_context * ctx0 = ggml_init(params);
|
| 538 |
struct ggml_cgraph gf = { .n_threads = n_threads };
|
|
|
|
| 325 |
|
| 326 |
// create the ggml context
|
| 327 |
{
|
| 328 |
+
struct ggml_init_params params;
|
| 329 |
+
params.mem_size = ctx_size;
|
| 330 |
+
params.mem_buffer = NULL;
|
|
|
|
| 331 |
|
| 332 |
model.ctx = ggml_init(params);
|
| 333 |
if (!model.ctx) {
|
|
|
|
| 528 |
}
|
| 529 |
}
|
| 530 |
|
| 531 |
+
struct ggml_init_params params;
|
| 532 |
+
params.mem_size = buf_size;
|
| 533 |
+
params.mem_buffer = buf;
|
|
|
|
| 534 |
|
| 535 |
struct ggml_context * ctx0 = ggml_init(params);
|
| 536 |
struct ggml_cgraph gf = { .n_threads = n_threads };
|
examples/talk/gpt-2.cpp
CHANGED
|
@@ -325,10 +325,9 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab &
|
|
| 325 |
|
| 326 |
// create the ggml context
|
| 327 |
{
|
| 328 |
-
struct ggml_init_params params
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
};
|
| 332 |
|
| 333 |
model.ctx = ggml_init(params);
|
| 334 |
if (!model.ctx) {
|
|
@@ -529,10 +528,9 @@ bool gpt2_eval(
|
|
| 529 |
}
|
| 530 |
}
|
| 531 |
|
| 532 |
-
struct ggml_init_params params
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
};
|
| 536 |
|
| 537 |
struct ggml_context * ctx0 = ggml_init(params);
|
| 538 |
struct ggml_cgraph gf = { .n_threads = n_threads };
|
|
|
|
| 325 |
|
| 326 |
// create the ggml context
|
| 327 |
{
|
| 328 |
+
struct ggml_init_params params;
|
| 329 |
+
params.mem_size = ctx_size;
|
| 330 |
+
params.mem_buffer = NULL;
|
|
|
|
| 331 |
|
| 332 |
model.ctx = ggml_init(params);
|
| 333 |
if (!model.ctx) {
|
|
|
|
| 528 |
}
|
| 529 |
}
|
| 530 |
|
| 531 |
+
struct ggml_init_params params;
|
| 532 |
+
params.mem_size = buf_size;
|
| 533 |
+
params.mem_buffer = buf;
|
|
|
|
| 534 |
|
| 535 |
struct ggml_context * ctx0 = ggml_init(params);
|
| 536 |
struct ggml_cgraph gf = { .n_threads = n_threads };
|