Skip to content

Commit

Permalink
fix gc collect
Browse files Browse the repository at this point in the history
  • Loading branch information
LowinLi committed Oct 7, 2022
1 parent 945107e commit 7c0f602
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/stable-diffusion-streamlit/pages/文字转图片.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from datetime import datetime
import json
import os
import gc
from diffusers.training_utils import set_seed

from pages.model.inference import result_dir, quant_pipe
Expand Down Expand Up @@ -129,6 +130,8 @@
json_filename = os.path.join(result_dir, "text2image", uid, "config.json")
os.makedirs(os.path.join(result_dir, "text2image", uid), exist_ok=True)
t.get_result().images[0].save(image_filename)
del t
gc.collect()
with open(json_filename, "w") as f:
config = {
"text_prompt": text_prompt,
Expand Down

0 comments on commit 7c0f602

Please sign in to comment.