MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / set_batch

Method set_batch

llama_cpp/_internals.py:505–514  ·  view source on GitHub ↗
(self, batch: Sequence[int], n_past: int, logits_all: bool)

Source from the content-addressed store, hash-verified

503 self.batch.n_tokens = 0
504
505 def set_batch(self, batch: Sequence[int], n_past: int, logits_all: bool):
506 n_tokens = len(batch)
507 self.batch.n_tokens = n_tokens
508 for i in range(n_tokens):
509 self.batch.token[i] = batch[i]
510 self.batch.pos[i] = n_past + i
511 self.batch.seq_id[i][0] = 0
512 self.batch.n_seq_id[i] = 1
513 self.batch.logits[i] = logits_all
514 self.batch.logits[n_tokens - 1] = True
515
516 def add_sequence(self, batch: Sequence[int], seq_id: int, logits_all: bool):
517 n_tokens = len(batch)

Callers 2

test_real_modelFunction · 0.95
evalMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_real_modelFunction · 0.76