| 186 | } |
| 187 | |
| 188 | llama_ubatch llama_sbatch::split_seq(size_t n_ubatch) { |
| 189 | n_ubatch = n_tokens < n_ubatch ? n_tokens : n_ubatch; |
| 190 | llama_ubatch ubatch = reserve_ubatch(n_ubatch, /* has_embd */ batch->embd != nullptr); |
| 191 | if (!seq.empty()) { |
| 192 | llama_sbatch_seq & s = seq[seq.size() - 1]; |
| 193 | size_t length = s.length < n_ubatch ? s.length : n_ubatch; |
| 194 | GGML_ASSERT(s.n_seq_id > 0); // should not be mixed with simple splits |
| 195 | add_seq_to_ubatch(ubatch, s, length); |
| 196 | } |
| 197 | return ubatch; |
| 198 | } |
| 199 | |
| 200 | llama_sbatch::llama_sbatch(const llama_batch & batch, size_t n_embd, bool simple_split, bool logits_all) { |
| 201 | GGML_ASSERT(batch.n_tokens >= 0); |
no test coverage detected