| 226 | } |
| 227 | |
| 228 | void add_child(int id_parent, int id_child) { |
| 229 | server_task copy; |
| 230 | |
| 231 | copy.id = id_child; |
| 232 | copy.id_parent = id_parent; |
| 233 | copy.params = params; |
| 234 | copy.type = type; |
| 235 | copy.tokens = tokens.clone(); |
| 236 | copy.id_slot = -1; // child tasks cannot specify slot |
| 237 | |
| 238 | // use different sampling seed for each child |
| 239 | // note: https://github.com/ggml-org/llama.cpp/pull/18700#discussion_r2675115723 |
| 240 | if (copy.params.sampling.seed != LLAMA_DEFAULT_SEED) { |
| 241 | copy.params.sampling.seed += (uint32_t)child_tasks.size() + 1; |
| 242 | } |
| 243 | |
| 244 | child_tasks.push_back(std::move(copy)); |
| 245 | } |
| 246 | |
| 247 | // the task will be moved into queue, then onto slots |
| 248 | // however, the state must be kept by caller (e.g., HTTP thread) |
no test coverage detected