Spaces:
Runtime error
Runtime error
Update min_dalle/min_dalle.py
Browse files- min_dalle/min_dalle.py +3 -4
min_dalle/min_dalle.py
CHANGED
@@ -239,9 +239,9 @@ class MinDalle:
|
|
239 |
break
|
240 |
st.session_state.bar.progress(i/IMAGE_TOKEN_COUNT)
|
241 |
|
242 |
-
|
243 |
#torch.cpu.empty_cache()
|
244 |
-
with torch.
|
245 |
image_tokens[i + 1], attention_state = self.decoder.forward(
|
246 |
settings=settings,
|
247 |
attention_mask=attention_mask,
|
@@ -250,9 +250,8 @@ class MinDalle:
|
|
250 |
prev_tokens=image_tokens[i],
|
251 |
token_index=token_indices[[i]]
|
252 |
)
|
253 |
-
|
254 |
|
255 |
-
with torch.
|
256 |
if ((i + 1) % 32 == 0 and progressive_outputs) or i + 1 == 256:
|
257 |
yield self.image_grid_from_tokens(
|
258 |
image_tokens=image_tokens[1:].T,
|
|
|
239 |
break
|
240 |
st.session_state.bar.progress(i/IMAGE_TOKEN_COUNT)
|
241 |
|
242 |
+
torch.cuda.empty_cache()
|
243 |
#torch.cpu.empty_cache()
|
244 |
+
with torch.cuda.amp.autocast(dtype=self.bfloat16):
|
245 |
image_tokens[i + 1], attention_state = self.decoder.forward(
|
246 |
settings=settings,
|
247 |
attention_mask=attention_mask,
|
|
|
250 |
prev_tokens=image_tokens[i],
|
251 |
token_index=token_indices[[i]]
|
252 |
)
|
|
|
253 |
|
254 |
+
with torch.cuda.amp.autocast(dtype=torch.bfloat16):
|
255 |
if ((i + 1) % 32 == 0 and progressive_outputs) or i + 1 == 256:
|
256 |
yield self.image_grid_from_tokens(
|
257 |
image_tokens=image_tokens[1:].T,
|