Spaces:
Runtime error
Runtime error
Update min_dalle/min_dalle.py
Browse files- min_dalle/min_dalle.py +15 -16
min_dalle/min_dalle.py
CHANGED
@@ -241,23 +241,22 @@ class MinDalle:
|
|
241 |
|
242 |
#torch.cuda.empty_cache()
|
243 |
#torch.cpu.empty_cache()
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
)
|
261 |
|
262 |
def generate_image_stream(self, *args, **kwargs) -> Iterator[Image.Image]:
|
263 |
image_stream = self.generate_raw_image_stream(*args, **kwargs)
|
|
|
241 |
|
242 |
#torch.cuda.empty_cache()
|
243 |
#torch.cpu.empty_cache()
|
244 |
+
|
245 |
+
image_tokens[i + 1], attention_state = self.decoder.forward(
|
246 |
+
settings=settings,
|
247 |
+
attention_mask=attention_mask,
|
248 |
+
encoder_state=encoder_state,
|
249 |
+
attention_state=attention_state,
|
250 |
+
prev_tokens=image_tokens[i],
|
251 |
+
token_index=token_indices[[i]]
|
252 |
+
)
|
253 |
|
254 |
+
if ((i + 1) % 32 == 0 and progressive_outputs) or i + 1 == 256:
|
255 |
+
yield self.image_grid_from_tokens(
|
256 |
+
image_tokens=image_tokens[1:].T,
|
257 |
+
is_seamless=is_seamless,
|
258 |
+
is_verbose=is_verbose
|
259 |
+
)
|
|
|
260 |
|
261 |
def generate_image_stream(self, *args, **kwargs) -> Iterator[Image.Image]:
|
262 |
image_stream = self.generate_raw_image_stream(*args, **kwargs)
|