Loading...
Searching...
No Matches
transformer_decoder.h
Go to the documentation of this file.
54 string decode(const string& source, const SamplingConfig& config, const TokenCallback& on_token);
Token-based language dataset with input/target vocabularies and binary token cache.
Definition language_dataset.h:19
string decode_to_stream(const string &source, const SamplingConfig &config, ostream &out)
Generates a completion using the given sampling configuration and writes each token to the stream.
TransformerDecoder(const TransformerDecoder &)=delete
~TransformerDecoder()=default
string decode_to_stream(const string &source, ostream &out)
Generates a completion for the given source and writes each emitted token to the output stream.
string decode(const string &source, const SamplingConfig &config, const TokenCallback &on_token)
Generates a completion using the given sampling configuration and streams tokens via the callback.
void chat()
Runs an interactive REPL: reads prompts from cin, streams predictions to cout, exits on empty line / ...
function< void(const string &token)> TokenCallback
Callback invoked for each token emitted during streaming decoding.
Definition transformer_decoder.h:36
TransformerDecoder(Transformer &, const LanguageDataset &)
Builds the decoder bound to a Transformer model and the language dataset providing its vocabulary.
string decode(const string &source)
Generates a completion for the given source using the default sampling configuration.
string decode(const string &source, const SamplingConfig &config)
Generates a completion for the given source using the supplied sampling configuration.
void chat(const SamplingConfig &config)
Runs the interactive REPL with the supplied sampling configuration.
TransformerDecoder & operator=(const TransformerDecoder &)=delete
string decode(const string &source, const TokenCallback &on_token)
Generates a completion for the given source and invokes the callback for each emitted token.
Factory encoder-decoder Transformer neural network for sequence-to-sequence tasks.
Definition standard_networks.h:123
Definition adaptive_moment_estimation.h:14
Owning raw byte buffer that lives on CPU or CUDA memory, with aligned (re)allocation.
Definition tensor_utilities.h:166
Non-owning view over a tensor: pointer, shape, and data type with rich reshape helpers.
Definition tensor_utilities.h:293
Sampling parameters that control how the next token is drawn from the model output distribution.
Definition transformer_decoder.h:27
float temperature
Definition transformer_decoder.h:28
float repetition_penalty
Definition transformer_decoder.h:31
Index maximum_tokens
Definition transformer_decoder.h:32