llama_batch_init: Initialise a llama batch

View source: R/llama.R

llama_batch_initR Documentation

Initialise a llama batch

Description

Allocates a llama_batch that can hold up to n_tokens tokens. Use llama_batch_free() to release the memory when done.

Usage

llama_batch_init(n_tokens, embd = 0L, n_seq_max = 1L)

Arguments

n_tokens

Maximum number of tokens in the batch.

embd

Embedding size; 0 means token-ID mode (normal inference).

n_seq_max

Maximum number of sequences per token.

Value

An external pointer to the allocated batch.

Examples

## Not run: 
batch <- llama_batch_init(512L)
llama_batch_free(batch)

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.