Skip to content

Commit

Permalink
Fix noise images generated for '--num' > 1 in Stable Diffusion sample (
Browse files Browse the repository at this point in the history
…#441)

Fixes #405
  • Loading branch information
yatarkan authored May 15, 2024
1 parent 234ad87 commit d73346c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions image_generation/stable_diffusion_1_5/cpp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ int32_t main(int32_t argc, char* argv[]) try {

ov::Tensor text_embeddings = text_encoder(models, positive_prompt, negative_prompt);

std::shared_ptr<Scheduler> scheduler = std::make_shared<LMSDiscreteScheduler>();
scheduler->set_timesteps(num_inference_steps);
std::vector<std::int64_t> timesteps = scheduler->get_timesteps();

for (uint32_t n = 0; n < num_images; n++) {
std::shared_ptr<Scheduler> scheduler = std::make_shared<LMSDiscreteScheduler>();
scheduler->set_timesteps(num_inference_steps);
std::vector<std::int64_t> timesteps = scheduler->get_timesteps();

std::uint32_t seed = num_images == 1 ? user_seed : user_seed + n;

const size_t unet_in_channels = static_cast<size_t>(sample_shape[1].get_length());
Expand Down

0 comments on commit d73346c

Please sign in to comment.