Update src/pipeline.py
Browse files- src/pipeline.py +2 -3
src/pipeline.py
CHANGED
|
@@ -138,7 +138,7 @@ def load_pipeline() -> Pipeline:
|
|
| 138 |
torch_dtype=dtype,
|
| 139 |
vae=vae,
|
| 140 |
# load_in_8bit=True,
|
| 141 |
-
)
|
| 142 |
# pipeline.vae = torch.compile(pipeline.vae, mode="reduce-overhead")
|
| 143 |
pipeline.vae.to(memory_format=torch.channels_last)
|
| 144 |
pipeline.text_encoder.to(memory_format=torch.channels_last)
|
|
@@ -155,8 +155,7 @@ def load_pipeline() -> Pipeline:
|
|
| 155 |
|
| 156 |
@torch.inference_mode()
|
| 157 |
def infer(request: TextToImageRequest, pipeline: Pipeline) -> Image:
|
| 158 |
-
|
| 159 |
-
generator = Generator().manual_seed(request.seed)
|
| 160 |
# image=pipeline(request.prompt,generator=generator, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256, height=request.height, width=request.width, output_type="pil").images[0]
|
| 161 |
# return(image)
|
| 162 |
image=pipeline(request.prompt,
|
|
|
|
| 138 |
torch_dtype=dtype,
|
| 139 |
vae=vae,
|
| 140 |
# load_in_8bit=True,
|
| 141 |
+
).to(device)
|
| 142 |
# pipeline.vae = torch.compile(pipeline.vae, mode="reduce-overhead")
|
| 143 |
pipeline.vae.to(memory_format=torch.channels_last)
|
| 144 |
pipeline.text_encoder.to(memory_format=torch.channels_last)
|
|
|
|
| 155 |
|
| 156 |
@torch.inference_mode()
|
| 157 |
def infer(request: TextToImageRequest, pipeline: Pipeline) -> Image:
|
| 158 |
+
generator = Generator(pipeline.device).manual_seed(request.seed)
|
|
|
|
| 159 |
# image=pipeline(request.prompt,generator=generator, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256, height=request.height, width=request.width, output_type="pil").images[0]
|
| 160 |
# return(image)
|
| 161 |
image=pipeline(request.prompt,
|