summaryrefslogtreecommitdiff
path: root/candle-examples/examples/stable-diffusion/clip.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-08-08 15:57:09 +0200
committerGitHub <noreply@github.com>2023-08-08 14:57:09 +0100
commit89d3926c9b0f497b48624f2719df6091e5d8785c (patch)
tree2ea4a853372ac48b1e6660dd5872958c6c05d54d /candle-examples/examples/stable-diffusion/clip.rs
parentab3568432608316b89791eaa4085a5cb519fe6c3 (diff)
downloadcandle-89d3926c9b0f497b48624f2719df6091e5d8785c.tar.gz
candle-89d3926c9b0f497b48624f2719df6091e5d8785c.tar.bz2
candle-89d3926c9b0f497b48624f2719df6091e5d8785c.zip
Fixes for the stable diffusion example. (#342)
* Fixes for the stable diffusion example. * Bugfix. * Another fix. * Fix for group-norm. * More fixes to get SD to work.
Diffstat (limited to 'candle-examples/examples/stable-diffusion/clip.rs')
-rw-r--r--candle-examples/examples/stable-diffusion/clip.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/candle-examples/examples/stable-diffusion/clip.rs b/candle-examples/examples/stable-diffusion/clip.rs
index ac9843f7..12f482fd 100644
--- a/candle-examples/examples/stable-diffusion/clip.rs
+++ b/candle-examples/examples/stable-diffusion/clip.rs
@@ -29,7 +29,7 @@ pub struct Config {
embed_dim: usize, // aka config.hidden_size
activation: Activation, // aka config.hidden_act
intermediate_size: usize,
- max_position_embeddings: usize,
+ pub max_position_embeddings: usize,
// The character to use for padding, use EOS when not set.
pad_with: Option<String>,
num_hidden_layers: usize,
@@ -90,7 +90,7 @@ impl ClipTextEmbeddings {
vs.pp("position_embedding"),
)?;
let position_ids =
- Tensor::arange(0u32, c.max_position_embeddings as u32, vs.device())?.unsqueeze(1)?;
+ Tensor::arange(0u32, c.max_position_embeddings as u32, vs.device())?.unsqueeze(0)?;
Ok(ClipTextEmbeddings {
token_embedding,
position_embedding,