StreamingTokenDecoder
Namespace: LLama
Decodes a stream of tokens into a stream of characters
1 | |
Inheritance Object → StreamingTokenDecoder
Attributes NullableContextAttribute, NullableAttribute
Properties
AvailableCharacters
The number of decoded characters waiting to be read
1 | |
Property Value
DecodeSpecialTokens
If true, special characters will be converted to text. If false they will be invisible.
1 | |
Property Value
Constructors
StreamingTokenDecoder(Encoding, LLamaWeights)
Create a new decoder
1 | |
Parameters
encoding Encoding
Text encoding to use
weights LLamaWeights
Model weights
StreamingTokenDecoder(LLamaContext)
Create a new decoder
1 | |
Parameters
context LLamaContext
Context to retrieve encoding and model weights from
StreamingTokenDecoder(Encoding, SafeLLamaContextHandle)
Create a new decoder
1 | |
Parameters
encoding Encoding
Text encoding to use
context SafeLLamaContextHandle
Context to retrieve model weights from
StreamingTokenDecoder(Encoding, SafeLlamaModelHandle)
Create a new decoder
1 | |
Parameters
encoding Encoding
Text encoding to use
weights SafeLlamaModelHandle
Models weights to use
Methods
Add(LLamaToken)
Add a single token to the decoder
1 | |
Parameters
token LLamaToken
Add(Int32)
Add a single token to the decoder
1 | |
Parameters
token Int32
AddRange<T>(T)
Add all tokens in the given enumerable
1 | |
Type Parameters
T
Parameters
tokens T
AddRange(ReadOnlySpan<LLamaToken>)
Add all tokens in the given span
1 | |
Parameters
tokens ReadOnlySpan<LLamaToken>
Read(List<Char>)
Read all decoded characters and clear the buffer
1 | |
Parameters
dest List<Char>
Read()
Read all decoded characters as a string and clear the buffer
1 | |
Returns
Reset()
Set the decoder back to its initial state
1 | |