Return the VAE scaling factor for a given SD version.
(version: StableDiffusionVersion)
| 688 | |
| 689 | /// Return the VAE scaling factor for a given SD version. |
| 690 | pub(crate) fn vae_scale_factor(version: StableDiffusionVersion) -> f64 { |
| 691 | match version { |
| 692 | StableDiffusionVersion::V1_5 |
| 693 | | StableDiffusionVersion::V2_1 |
| 694 | | StableDiffusionVersion::Xl => 0.18215, |
| 695 | StableDiffusionVersion::Turbo => 0.13025, |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | fn image_preprocess<T: AsRef<std::path::Path>>(path: T) -> Result<Tensor> { |
| 700 | let img = image::ImageReader::open(path)?.decode()?; |
no outgoing calls