Skip to content

Commit ff536f6

Browse files
authored
[SD] Deduplicate initial noise generation (huggingface#677)
1 parent 097d0f2 commit ff536f6

File tree

1 file changed

+1
-7
lines changed
  • shark/examples/shark_inference/stable_diffusion

1 file changed

+1
-7
lines changed

shark/examples/shark_inference/stable_diffusion/main.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ def end_profiling(device):
7070
if batch_size != len(neg_prompt):
7171
sys.exit("prompts and negative prompts must be of same length")
7272

73-
# create a random initial latent.
74-
latents = torch.randn(
75-
(batch_size, 4, height // 8, width // 8),
76-
generator=generator,
77-
dtype=torch.float32,
78-
).to(dtype)
79-
8073
set_iree_runtime_flags()
8174
unet = get_unet()
8275
vae = get_vae()
@@ -118,6 +111,7 @@ def end_profiling(device):
118111
subfolder="scheduler",
119112
)
120113

114+
# create a random initial latent.
121115
latents = torch.randn(
122116
(batch_size, 4, height // 8, width // 8),
123117
generator=generator,

0 commit comments

Comments
 (0)