v0.8.0
Auto tokenizer #49
Inspired by Hugging Face's Transformers' Auto Classes
, this feature simplifies the tokenizer selection process by automatically choosing the correct tokenizer for a given model.
Stream API #52
Added a callback-based streaming API.
The following example demonstrates how to translate source
and print results step-by-step:
let _ = translator.translate_batch(
&vec![source],
&TranslationOptions {
// beam_size must be 1 to use the stream API.
beam_size: 1,
..Default::default()
},
// Each time a new token is generated, the following callback closure is called.
// In this example, it writes to the standard output sequentially.
Some(&mut |r: GenerationStepResult| -> Result<()> {
write!(out, "{}", r.text)?;
out.flush()?;
Ok(())
}),
)?;
See the whole example code for more information.