MCPcopy Create free account
hub / github.com/evilsocket/cake / load_model

Method load_model

cake-core/src/models/sd/vae.rs:88–106  ·  view source on GitHub ↗
(
        name: Option<String>,
        version: StableDiffusionVersion,
        use_f16: bool,
        device: &Device,
        dtype: DType,
        cache_dir: String,
        config: &StableDiffusi

Source from the content-addressed store, hash-verified

86
87impl VAE {
88 pub fn load_model(
89 name: Option<String>,
90 version: StableDiffusionVersion,
91 use_f16: bool,
92 device: &Device,
93 dtype: DType,
94 cache_dir: String,
95 config: &StableDiffusionConfig,
96 ) -> anyhow::Result<Box<Self>>
97 where
98 Self: Sized,
99 {
100 let vae_weights = ModelFile::Vae.get(name, version, use_f16, cache_dir)?;
101 let vae_model = config.build_vae(vae_weights, device, dtype)?;
102
103 info!("Loading VAE model...");
104
105 Ok(Box::new(Self { vae_model }))
106 }
107
108 pub async fn encode(
109 forwarder: &mut Box<dyn Forwarder>,

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected