| 12 | #endif |
| 13 | |
| 14 | static std::vector<std::string> split_lines(const std::string & s, const std::string & separator = "\n") { |
| 15 | std::vector<std::string> lines; |
| 16 | size_t start = 0; |
| 17 | size_t end = s.find(separator); |
| 18 | |
| 19 | while (end != std::string::npos) { |
| 20 | lines.push_back(s.substr(start, end - start)); |
| 21 | start = end + separator.length(); |
| 22 | end = s.find(separator, start); |
| 23 | } |
| 24 | |
| 25 | lines.push_back(s.substr(start)); // Add the last part |
| 26 | |
| 27 | return lines; |
| 28 | } |
| 29 | |
| 30 | static void batch_add_seq(llama_batch & batch, const std::vector<int32_t> & tokens, llama_seq_id seq_id) { |
| 31 | size_t n_tokens = tokens.size(); |