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