Skip to content

Commit c5b8e67

Browse files
committed
feat(stable_diffusion): expose StableDiffusionConfig.unet() and .autoencoder() accessors
Downstream consumers (e.g. mold's single-file SD1.5/SDXL Civitai checkpoint loader) need to construct UNet2DConditionModel and AutoEncoderKL with a custom VarBuilder backend. The configs sit on private fields with no accessor, blocking that path. Adding two read-only accessor methods is the minimal additive fix.
1 parent aa70d79 commit c5b8e67

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exclude = [
1515
resolver = "2"
1616

1717
[workspace.package]
18-
version = "0.9.10"
18+
version = "0.9.12"
1919
edition = "2021"
2020
description = "Minimalist ML framework (mold fork with LTX Video models, Metal fixes)."
2121
repository = "https://github.com/utensils/candle"

candle-transformers/src/models/stable_diffusion/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,16 @@ impl StableDiffusionConfig {
513513
pub fn build_scheduler(&self, n_steps: usize) -> Result<Box<dyn Scheduler>> {
514514
self.scheduler.build(n_steps)
515515
}
516+
517+
/// Read-only access to the UNet sub-configuration.
518+
pub fn unet(&self) -> &unet_2d::UNet2DConditionModelConfig {
519+
&self.unet
520+
}
521+
522+
/// Read-only access to the autoencoder (VAE) sub-configuration.
523+
pub fn autoencoder(&self) -> &vae::AutoEncoderKLConfig {
524+
&self.autoencoder
525+
}
516526
}
517527

518528
pub fn build_clip_transformer<P: AsRef<std::path::Path>>(

0 commit comments

Comments
 (0)