Skip to content

Commit

Permalink
Clear torch resources wen done #5
Browse files Browse the repository at this point in the history
  • Loading branch information
pramitchoudhary committed Oct 31, 2022
1 parent f719aec commit 1387a24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions img_styler/image_prompt/stable_diffusion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc
import torch
from torch import autocast
from PIL import Image
Expand All @@ -24,4 +25,6 @@ def generate_image_with_prompt(input_img_path: str, prompt_txt: str = "Face port

file_name = output_path + '/result.jpg'
images[0].save(file_name)
gc.collect()
torch.cuda.empty_cache()
return file_name

0 comments on commit 1387a24

Please sign in to comment.