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

Method load_model

cake-core/src/models/sd/unet.rs:83–102  ·  view source on GitHub ↗
(
        name: Option<String>,
        use_flash_attn: bool,
        version: StableDiffusionVersion,
        use_f16: bool,
        device: &Device,
        dtype: DType,
        cache_dir: String,

Source from the content-addressed store, hash-verified

81impl UNet {
82 #[allow(clippy::too_many_arguments)]
83 pub fn load_model(
84 name: Option<String>,
85 use_flash_attn: bool,
86 version: StableDiffusionVersion,
87 use_f16: bool,
88 device: &Device,
89 dtype: DType,
90 cache_dir: String,
91 config: &StableDiffusionConfig,
92 ) -> anyhow::Result<Box<Self>>
93 where
94 Self: Sized,
95 {
96 let unet_weights = ModelFile::Unet.get(name, version, use_f16, cache_dir)?;
97 let unet = config.build_unet(unet_weights, device, 4, use_flash_attn, dtype)?;
98
99 info!("Loading UNet model...");
100
101 Ok(Box::new(Self { unet_model: unet }))
102 }
103
104 pub async fn forward_unpacked(
105 forwarder: &mut Box<dyn Forwarder>,

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected