MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / load_stable_diffusion

Function load_stable_diffusion

src/model/stablediffusion/load.rs:16–33  ·  view source on GitHub ↗
(
    path: &str,
    device: &B::Device,
)

Source from the content-addressed store, hash-verified

14};
15
16pub fn load_stable_diffusion<B: Backend>(
17 path: &str,
18 device: &B::Device,
19) -> Result<StableDiffusion<B>, Box<dyn Error>> {
20 let n_steps = load_usize::<B>("n_steps", path, device)?;
21 let alpha_cumulative_products = Param::from_tensor(load_tensor::<B, 1>("alphas_cumprod", path, device)?);
22 let autoencoder = load_autoencoder(&format!("{}/{}", path, "autoencoder"), device)?;
23 let diffusion = load_unet(&format!("{}/{}", path, "unet"), device)?;
24 let clip = load_clip(&format!("{}/{}", path, "clip"), device)?;
25
26 Ok(StableDiffusion {
27 n_steps,
28 alpha_cumulative_products,
29 autoencoder,
30 diffusion,
31 clip,
32 })
33}

Callers 2

mainFunction · 0.85
convert_dump_to_modelFunction · 0.85

Calls 3

load_autoencoderFunction · 0.85
load_unetFunction · 0.85
load_clipFunction · 0.85

Tested by

no test coverage detected