JMalott commited on
Commit
11dc765
·
1 Parent(s): 3905589

Update min_dalle/min_dalle.py

Browse files
Files changed (1) hide show
  1. min_dalle/min_dalle.py +5 -4
min_dalle/min_dalle.py CHANGED
@@ -242,8 +242,6 @@ class MinDalle:
242
 
243
  torch.cuda.empty_cache()
244
 
245
- #time.sleep(0.5)
246
-
247
  with torch.cuda.amp.autocast(dtype=self.dtype):
248
  image_tokens[i + 1], attention_state = self.decoder.forward(
249
  settings=settings,
@@ -253,8 +251,7 @@ class MinDalle:
253
  prev_tokens=image_tokens[i],
254
  token_index=token_indices[[i]]
255
  )
256
-
257
- #torch.cuda.empty_cache()
258
 
259
  with torch.cuda.amp.autocast(dtype=torch.float16):
260
  if ((i + 1) % 16 == 0 and progressive_outputs) or i + 1 == 256:
@@ -263,6 +260,10 @@ class MinDalle:
263
  is_seamless=is_seamless,
264
  is_verbose=is_verbose
265
  )
 
 
 
 
266
 
267
  def generate_image_stream(self, *args, **kwargs) -> Iterator[Image.Image]:
268
  image_stream = self.generate_raw_image_stream(*args, **kwargs)
 
242
 
243
  torch.cuda.empty_cache()
244
 
 
 
245
  with torch.cuda.amp.autocast(dtype=self.dtype):
246
  image_tokens[i + 1], attention_state = self.decoder.forward(
247
  settings=settings,
 
251
  prev_tokens=image_tokens[i],
252
  token_index=token_indices[[i]]
253
  )
254
+
 
255
 
256
  with torch.cuda.amp.autocast(dtype=torch.float16):
257
  if ((i + 1) % 16 == 0 and progressive_outputs) or i + 1 == 256:
 
260
  is_seamless=is_seamless,
261
  is_verbose=is_verbose
262
  )
263
+ del attention_state
264
+ del image_tokens
265
+
266
+
267
 
268
  def generate_image_stream(self, *args, **kwargs) -> Iterator[Image.Image]:
269
  image_stream = self.generate_raw_image_stream(*args, **kwargs)