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 + } } }