Skip to main content

Generator

Trait Generator 

Source
pub trait Generator {
    type Shardable: Forwarder;

    const MODEL_NAME: &'static str;

    // Required method
    fn load<'life0, 'async_trait>(
        context: &'life0 mut Context,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Box<Self>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A model must implement this trait in order to be usable by the Cake framework.

Required Associated Constants§

Source

const MODEL_NAME: &'static str

The model name.

Required Associated Types§

Source

type Shardable: Forwarder

This associated type determines which part of the model can be sharded.

Required Methods§

Source

fn load<'life0, 'async_trait>( context: &'life0 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Option<Box<Self>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the model from the context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Generator for LLama

Source§

const MODEL_NAME: &'static str = "llama3"

Source§

type Shardable = Transformer

Source§

impl Generator for Qwen2

Source§

const MODEL_NAME: &'static str = "qwen2"

Source§

type Shardable = Transformer

Source§

impl Generator for Qwen3_5

Source§

const MODEL_NAME: &'static str = "qwen3_5"

Source§

type Shardable = Qwen3_5Block

Source§

impl Generator for SD

Source§

const MODEL_NAME: &'static str = "stable-diffusion"

Source§

type Shardable = SDShardable