LlamaModel

A loaded llama model that frees itself on destruction.

Members

Functions

chatTemplate
const(char)* chatTemplate(const(char)* name)

Jinja chat template embedded in the model (or the named variant). Returns null if none is available. Pass name = null for the default template.

metaKeyAt
string metaKeyAt(int index)

Metadata key name at index. Returns "" on failure.

metaVal
string metaVal(string key)

Metadata value (as string) for the given key. Returns "" on failure.

metaValAt
string metaValAt(int index)

Metadata value (as string) at index. Returns "" on failure.

Mixins

__anonymous
mixin Owned!(llama_model, llama_model_free)
Undocumented in source.

Properties

decoderStartToken
llama_token decoderStartToken [@property getter]

Start token for the decoder; falls back to BOS for encoder-decoder models.

desc
string desc [@property getter]

Short description string (architecture + size).

hasDecoder
bool hasDecoder [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
hasEncoder
bool hasEncoder [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isRecurrent
bool isRecurrent [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
metaCount
int metaCount [@property getter]

Number of key/value metadata pairs.

nCtxTrain
int nCtxTrain [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nEmbd
int nEmbd [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nHead
int nHead [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nLayer
int nLayer [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nParams
ulong nParams [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nVocab
int nVocab [@property getter]

Number of tokens in the vocabulary.

size
ulong size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
vocab
const(llama_vocab)* vocab [@property getter]

Model vocabulary.

Static functions

loadFromFile
LlamaModel loadFromFile(const(char)* path, llama_model_params params)

Load from a GGUF file with pre-built params. Check if (model) after loading.

loadFromFile
LlamaModel loadFromFile(string path, int nGpuLayers)

Load from a D string path, with optional GPU layer count.

loadVocabOnly
LlamaModel loadVocabOnly(string path)

Load only the vocabulary (no weights). Useful for tokenization without inference.

Mixed In Members

From mixin Owned!(llama_model, llama_model_free)

this
this()
Undocumented in source.
this(this)
this(this)
Undocumented in source.
~this
~this()
Undocumented in source.
opCast
bool opCast()

True when the handle holds a non-null pointer.

ptr
T* ptr [@property getter]

Raw C pointer (mutable).

ptr
const(T)* ptr [@property getter]

Raw C pointer (const view).

Meta