LLamaWeights
Namespace: LLama
A set of model weights, loaded into memory.
1 | |
Inheritance Object → LLamaWeights
Implements IDisposable
Attributes NullableContextAttribute, NullableAttribute
Properties
NativeHandle
The native handle, which is used in the native APIs
1 | |
Property Value
Remarks:
Be careful how you use this!
ContextSize
Total number of tokens in the context
1 | |
Property Value
SizeInBytes
Get the size of this model in bytes
1 | |
Property Value
ParameterCount
Get the number of parameters in this model
1 | |
Property Value
EmbeddingSize
Dimension of embedding vectors
1 | |
Property Value
Vocab
Get the special tokens of this model
1 | |
Property Value
Metadata
All metadata keys in this model
1 | |
Property Value
IReadOnlyDictionary<String, String>
Methods
LoadFromFile(IModelParams)
Load weights into memory
1 | |
Parameters
params IModelParams
Returns
LoadFromFileAsync(IModelParams, CancellationToken, IProgress<Single>)
Load weights into memory
1 | |
Parameters
params IModelParams
Parameters to use to load the model
token CancellationToken
A cancellation token that can interrupt model loading
progressReporter IProgress<Single>
Receives progress updates as the model loads (0 to 1)
Returns
Exceptions
LoadWeightsFailedException
Thrown if weights failed to load for any reason. e.g. Invalid file format or loading cancelled.
OperationCanceledException
Thrown if the cancellation token is cancelled.
Dispose()
1 | |
CreateContext(IContextParams, ILogger)
Create a llama_context using this model
1 | |
Parameters
params IContextParams
logger ILogger
Returns
Tokenize(String, Boolean, Boolean, Encoding)
Convert a string of text into tokens
1 | |
Parameters
text String
add_bos Boolean
special Boolean
Allow tokenizing special and/or control tokens which otherwise are not exposed and treated as plaintext.
encoding Encoding