Manjushri commited on
Commit
8c080f9
·
verified ·
1 Parent(s): 600e95f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,12 +12,13 @@ import torch
12
  from openai import OpenAI
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
-
 
16
  pipe = CogView4Pipeline.from_pretrained("THUDM/CogView4-6B", torch_dtype=torch.bfloat16).to(device)
17
  pipe.enable_model_cpu_offload()
18
  pipe.vae.enable_slicing()
19
  pipe.vae.enable_tiling()
20
-
21
  def clean_string(s):
22
  s = s.replace("\n", " ")
23
  s = s.strip()
 
12
  from openai import OpenAI
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
+ torch.cuda.max_memory_allocated(device=device)
16
+ torch.cuda.empty_cache()
17
  pipe = CogView4Pipeline.from_pretrained("THUDM/CogView4-6B", torch_dtype=torch.bfloat16).to(device)
18
  pipe.enable_model_cpu_offload()
19
  pipe.vae.enable_slicing()
20
  pipe.vae.enable_tiling()
21
+ torch.cuda.empty_cache()
22
  def clean_string(s):
23
  s = s.replace("\n", " ")
24
  s = s.strip()