Crate kalosm_sample
source ·Expand description
§kalosm-sample
This is a sampling library for Kalosm.
It handles choosing a token from a probability distribution. Samplers can be used to constrain the generation of text for example you can use a sampler to prevent the model from generating the same word twice in a row. Or you could only allow the model to generate a list of single digit numbers.
Structs§
- A boxed parser.
- A parser for a fixed size array of a type.
- A parser for a choice of two parsers.
- State of a choice parser.
- A type erased wrapper for a tokenizer.
- A tokenizer that uses the HuggingFace tokenizer with a cache for single tokens.
- A parser for a float.
- The state of an integer parser.
- A parser for
i8
. - A parser for
i16
. - A parser for
i32
. - A parser for
i64
. - A parser for an integer.
- The state of an integer parser.
- The error type for a literal parser.
- A parser for a literal.
- The state of a literal parser.
- A parser that maps the output of another parser.
- A parser that uses a regex pattern to parse input.
- A parser for a repeat of two parsers.
- State of a repeat parser.
- A single word.
- A parser for a word.
- A parser for a repeat of two parsers.
- State of a repeat parser.
- A parser for a sequence of two parsers.
- A parser that parses until a literal is found.
- The state of a stop on literal parser.
- An error that can occur while parsing a string literal.
- An error that can occur while parsing a string literal.
- A parser for an ascii string.
- The state of a literal parser.
- A parser for
u8
. - A parser for
u16
. - A parser for
u32
. - A parser for
u64
. - A parser for a vector of a type.
- A single word.
- A parser for a word.
Enums§
- A value that can be one of two types.
- A parser for a choice between two parsers.
- The state of a parser.
- The state of the item in the separated parser.
- State of a sequence parser.
- A validator for a string
- The state of a structure parser.
Traits§
- A trait for a parser with a default state.
- Data that can be parsed incrementally.
- An incremental parser for a structured input.
- An extension trait for parsers.
- A tokenizer is a type that can decode a list of token ids into a string.