apolinario commited on
Commit
835d190
·
1 Parent(s): 0f52fbe

Set PYTORCH_CUDA_ALLOC_CONF=expandable_segments to fight fragmentation; explicit low_cpu_mem_usage=False on TAEF1 + add accelerate to requirements to silence the warning

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -3,6 +3,9 @@ import sys
3
  import subprocess
4
  import tempfile
5
 
 
 
 
6
  import spaces
7
 
8
 
@@ -102,7 +105,9 @@ pipeline.to("cuda")
102
 
103
  print("[pid] loading TAEF1 (fast preview decoder)...", flush=True)
104
  from diffusers import AutoencoderTiny
105
- taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=DTYPE).to("cuda")
 
 
106
  taef1.eval()
107
 
108
  def _load_pid(ckpt_type: str):
 
3
  import subprocess
4
  import tempfile
5
 
6
+ # Help the allocator survive the large-activation spikes during PiD pixel-space ops
7
+ os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
8
+
9
  import spaces
10
 
11
 
 
105
 
106
  print("[pid] loading TAEF1 (fast preview decoder)...", flush=True)
107
  from diffusers import AutoencoderTiny
108
+ taef1 = AutoencoderTiny.from_pretrained(
109
+ "madebyollin/taef1", torch_dtype=DTYPE, low_cpu_mem_usage=False
110
+ ).to("cuda")
111
  taef1.eval()
112
 
113
  def _load_pid(ckpt_type: str):
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  diffusers>=0.37.0
2
  transformers==4.57.1
3
  safetensors
 
1
+ accelerate
2
  diffusers>=0.37.0
3
  transformers==4.57.1
4
  safetensors