Skip to main content
CrystalDocs
Search documentation
Search
Browse Docs
CrystalShards
About
struct
Llama::Tokenizer
Inherits
Struct
<
Value
<
Object
Constructors
new
(vocab :
Array
(
String
) =
Array
(
String
).new, vocab_scores :
Array
(
Float32
) =
Array
(
Float32
).new, sorted_vocab :
Array
(
TokenIndex
) =
Array
(
TokenIndex
).new, vocab_size :
Int32
= 0, max_token_length :
UInt32
= 0_u32, byte_pieces :
Array
(
UInt8
) =
Array
(
UInt8
).new(512, 0_u8))
Source
Instance methods
build
(tokenizer_path :
String
)
Source
byte_pieces
Source
byte_pieces=
(byte_pieces :
Array
(
UInt8
))
Source
decode
(prev_token :
Int32
, token :
Int32
) :
String
Source
encode
(text :
String
, bos :
Bool
, eos :
Bool
) :
Array
(
Int32
)
Source
max_token_length
Source
max_token_length=
(max_token_length :
UInt32
)
Source
sorted_vocab
Source
sorted_vocab=
(sorted_vocab :
Array
(
TokenIndex
))
Source
vocab
Source
vocab=
(vocab :
Array
(
String
))
Source
vocab_scores
Source
vocab_scores=
(vocab_scores :
Array
(
Float32
))
Source
vocab_size
Source
vocab_size=
(vocab_size :
Int32
)
Source