pub trait Backend {
// Required methods
fn name(&self) -> &'static str;
fn bring_up(
&self,
spec: &ModelSpec,
checkpoint: &Path,
ctx: usize,
out: &Path,
) -> Result<Brought, Refused>;
fn run(
&self,
spec: &ModelSpec,
checkpoint: &Path,
ctx: usize,
out: &Path,
sequences: &[Sequence],
) -> Result<Generated, Refused>;
}Expand description
A chip a model’s one program is lowered to.
Required Methods§
Sourcefn bring_up(
&self,
spec: &ModelSpec,
checkpoint: &Path,
ctx: usize,
out: &Path,
) -> Result<Brought, Refused>
fn bring_up( &self, spec: &ModelSpec, checkpoint: &Path, ctx: usize, out: &Path, ) -> Result<Brought, Refused>
Lower spec’s program — the checkpoint at checkpoint — over caches of ctx positions, writing the artifacts
under out.
Sourcefn run(
&self,
spec: &ModelSpec,
checkpoint: &Path,
ctx: usize,
out: &Path,
sequences: &[Sequence],
) -> Result<Generated, Refused>
fn run( &self, spec: &ModelSpec, checkpoint: &Path, ctx: usize, out: &Path, sequences: &[Sequence], ) -> Result<Generated, Refused>
Run the model on this chip, what Backend::bring_up wrote under out beside it: every one of sequences
from an empty state, its prompt (token ids from 0) and then as many tokens as it is judged against, generated
greedily through the one program — or refuse by name, a chip that is not on this machine, or whose run is not
built yet, saying which.