pub fn deferred<'model>(&'model self, executor: &'model Executor) -> On<'model, Model, Deferring>
The library reads a deferred call's inputs after the verb returns, so lending borrowed texts
does not compile:
use uform::*;
let model = Model::load_ram("model.safetensors")?;
let executor = Executor::for_ram(&[], None, 0, 0)?;
let mut arena = Arena::new_in(&executor)?;
let texts = vec![String::from("a caption")];
let call = model.deferred(&executor).text_encode(&texts, Outputs::EMBEDDINGS, Scalar::F32, &mut arena)?;
Owned texts move into the call, and the arena is borrowed as a blocking call borrows it, and
so is the waited result:
use uform::*;
let model = Model::load_ram("model.safetensors")?;
let executor = Executor::for_ram(&[], None, 0, 0)?;
let mut arena = Arena::new_in(&executor)?;
let texts = vec![String::from("a caption")];
let call = model.deferred(&executor).text_encode(texts, Outputs::EMBEDDINGS, Scalar::F32, &mut arena)?;
let encoded = call.wait()?;
Rust-only.