MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _add_batch_token

Method _add_batch_token

examples/server/server.py:1429–1445  ·  view source on GitHub ↗
(
        self,
        *,
        token: int,
        pos: int,
        seq_id: int,
        logits: bool,
    )

Source from the content-addressed store, hash-verified

1427 )
1428
1429 def _add_batch_token(
1430 self,
1431 *,
1432 token: int,
1433 pos: int,
1434 seq_id: int,
1435 logits: bool,
1436 ) -> None:
1437 slot = int(self.batch.n_tokens)
1438 if slot >= self.n_batch:
1439 raise RuntimeError("MTP draft batch capacity exceeded")
1440 self.batch.token[slot] = int(token)
1441 self.batch.pos[slot] = int(pos)
1442 self.batch.seq_id[slot][0] = int(seq_id)
1443 self.batch.n_seq_id[slot] = 1
1444 self.batch.logits[slot] = int(logits)
1445 self.batch.n_tokens += 1
1446
1447 def _try_decode_batch(self) -> bool:
1448 n_tokens = int(self.batch.n_tokens)

Callers 7

_process_rowsMethod · 0.95
_draft_chain_headsMethod · 0.95
draftMethod · 0.95
draft_manyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected