(
path: &str,
device: &B::Device,
)
| 14 | }; |
| 15 | |
| 16 | pub 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 | } |
no test coverage detected