summaryrefslogtreecommitdiff
path: root/candle-examples/examples/stable-diffusion/main.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-08-06 18:49:43 +0200
committerGitHub <noreply@github.com>2023-08-06 17:49:43 +0100
commitd34039e35267b3f4de83770f8da4ea31491bcec5 (patch)
tree6efc4796859a04223d2211303cc12b3a97321fcc /candle-examples/examples/stable-diffusion/main.rs
parent93cfe5642f473889d1df62ccb8f1740f77523dd3 (diff)
downloadcandle-d34039e35267b3f4de83770f8da4ea31491bcec5.tar.gz
candle-d34039e35267b3f4de83770f8da4ea31491bcec5.tar.bz2
candle-d34039e35267b3f4de83770f8da4ea31491bcec5.zip
Add a stable diffusion example (#328)
* Start adding a stable-diffusion example. * Proper computation of the causal mask. * Add the chunk operation. * Work in progress: port the attention module. * Add some dummy modules for conv2d and group-norm, get the attention module to compile. * Re-enable the 2d convolution. * Add the embeddings module. * Add the resnet module. * Add the unet blocks. * Add the unet. * And add the variational auto-encoder. * Use the pad function from utils.
Diffstat (limited to 'candle-examples/examples/stable-diffusion/main.rs')
-rw-r--r--candle-examples/examples/stable-diffusion/main.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/candle-examples/examples/stable-diffusion/main.rs b/candle-examples/examples/stable-diffusion/main.rs
new file mode 100644
index 00000000..31848f38
--- /dev/null
+++ b/candle-examples/examples/stable-diffusion/main.rs
@@ -0,0 +1,30 @@
+#[cfg(feature = "mkl")]
+extern crate intel_mkl_src;
+
+mod attention;
+mod clip;
+mod embeddings;
+mod resnet;
+mod unet_2d;
+mod unet_2d_blocks;
+mod utils;
+mod vae;
+
+use anyhow::Result;
+use clap::Parser;
+
+#[derive(Parser, Debug)]
+#[command(author, version, about, long_about = None)]
+struct Args {
+ /// Run on CPU rather than on GPU.
+ #[arg(long)]
+ cpu: bool,
+
+ #[arg(long)]
+ prompt: String,
+}
+
+fn main() -> Result<()> {
+ let _args = Args::parse();
+ Ok(())
+}