From 17edd6c96f62940d6d027ad4701f51b7ae5c154a Mon Sep 17 00:00:00 2001 From: DandinPower Date: Sun, 22 Jun 2025 22:16:15 +0800 Subject: [PATCH] feat: remove the string_split function --- src/llama.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/llama.cpp b/src/llama.cpp index be78bb37..e60e0771 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -4766,9 +4766,17 @@ struct llama_model_loader { trace = atoi(getenv("LLAMA_TRACE")); } - if (split_str && split_str[0] != '\0') { - for (int s : string_split(split_str, ',')) { - if (s >= 0) split_list.insert((uint32_t)s); + if (split_str && *split_str) { + std::string tmp{split_str}; + std::stringstream ss(tmp); + std::string tok; + while (std::getline(ss, tok, ',')) { + try { + auto v = std::stoi(tok); + if (v >= 0) split_list.insert(static_cast(v)); + } catch (...) { + // ignore bad tokens + } } }