1
Add dependency to your Cargo.toml
Copy
[dependencies]
uzu = { git = "https://github.com/trymirai/uzu", branch = "main", package = "uzu" }
2
Convert the model you want to use
Check lalamo for the guide.
3
Copy the snippet
Don’t forget to set
MODEL_PATHCopy
use std::path::PathBuf;
use uzu::session::{
Session,
config::{DecodingConfig, RunConfig},
types::{Input, Output},
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let model_path = PathBuf::from("MODEL_PATH");
let mut session = Session::new(model_path, DecodingConfig::default())?;
let input = Input::Text(String::from("Tell about London"));
let output = session.run(
input,
RunConfig::default().tokens_limit(128),
Some(|_: Output| {
return true;
}),
)?;
println!("{}", output.text.original);
Ok(())
}