trying to clear cuda cache after each generation
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ base = DiffusionPipeline.from_pretrained(
|
|
| 14 |
base.to("cuda")
|
| 15 |
|
| 16 |
def text2Image(prompt, steps=50, scale=7, Width=1024, Height=1024):
|
|
|
|
| 17 |
image = base(prompt, num_inference_steps=steps, guidance_scale=scale,
|
| 18 |
width=Width, height=Height, cross_attention_kwargs={"scale": 1}).images[0]
|
| 19 |
return image
|
|
|
|
| 14 |
base.to("cuda")
|
| 15 |
|
| 16 |
def text2Image(prompt, steps=50, scale=7, Width=1024, Height=1024):
|
| 17 |
+
torch.cuda.empty_cache()
|
| 18 |
image = base(prompt, num_inference_steps=steps, guidance_scale=scale,
|
| 19 |
width=Width, height=Height, cross_attention_kwargs={"scale": 1}).images[0]
|
| 20 |
return image
|