From 490cf395f82d7d0582016a51054457e2d6f89769 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Fri, 23 Jun 2023 22:51:51 +0800 Subject: [PATCH] better alloc error --- otherarch/gpt2_v3.cpp | 2 +- otherarch/gptj_v3.cpp | 2 +- otherarch/mpt_v3.cpp | 2 +- otherarch/neox_v3.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/otherarch/gpt2_v3.cpp b/otherarch/gpt2_v3.cpp index b716fe212..fb15d662b 100644 --- a/otherarch/gpt2_v3.cpp +++ b/otherarch/gpt2_v3.cpp @@ -422,7 +422,7 @@ bool gpt2_eval( buf = realloc(buf, buf_size); if (buf == nullptr) { - fprintf(stderr, "%s: failed to allocate %zu bytes\n", __func__, buf_size); + fprintf(stderr, "%s: failed to allocate %zu bytes. Try reducing batch size.\n", __func__, buf_size); return false; } } diff --git a/otherarch/gptj_v3.cpp b/otherarch/gptj_v3.cpp index 031a2c051..b00bd6bd2 100644 --- a/otherarch/gptj_v3.cpp +++ b/otherarch/gptj_v3.cpp @@ -417,7 +417,7 @@ bool gptj_eval( buf = realloc(buf, buf_size); if (buf == nullptr) { - fprintf(stderr, "%s: failed to allocate %zu bytes\n", __func__, buf_size); + fprintf(stderr, "%s: failed to allocate %zu bytes. Try reducing batch size.\n", __func__, buf_size); return false; } } diff --git a/otherarch/mpt_v3.cpp b/otherarch/mpt_v3.cpp index 5d66f91f5..a60172f51 100644 --- a/otherarch/mpt_v3.cpp +++ b/otherarch/mpt_v3.cpp @@ -350,7 +350,7 @@ bool mpt_eval(const mpt_model & model, const int n_threads, const int n_past, buf_size = buf_size_new; buf = realloc(buf, buf_size); if (buf == nullptr) { - fprintf(stderr, "%s: failed to allocate %zu bytes\n", __func__, buf_size); + fprintf(stderr, "%s: failed to allocate %zu bytes. Try reducing batch size.\n", __func__, buf_size); return false; } } diff --git a/otherarch/neox_v3.cpp b/otherarch/neox_v3.cpp index 37f5ad9ae..245d383d6 100644 --- a/otherarch/neox_v3.cpp +++ b/otherarch/neox_v3.cpp @@ -435,7 +435,7 @@ bool gpt_neox_eval( buf = realloc(buf, buf_size); if (buf == nullptr) { - fprintf(stderr, "%s: failed to allocate %zu bytes\n", __func__, buf_size); + fprintf(stderr, "%s: failed to allocate %zu bytes. Try reducing batch size.\n", __func__, buf_size); return false; } }