Spaces:
Runtime error
Runtime error
Update min_dalle/min_dalle.py
Browse files- min_dalle/min_dalle.py +12 -1
min_dalle/min_dalle.py
CHANGED
@@ -12,6 +12,8 @@ from .models import DalleBartEncoder, DalleBartDecoder, VQGanDetokenizer
|
|
12 |
import streamlit as st
|
13 |
import time
|
14 |
|
|
|
|
|
15 |
torch.set_grad_enabled(False)
|
16 |
torch.set_num_threads(os.cpu_count())
|
17 |
torch.backends.cudnn.enabled = True
|
@@ -235,7 +237,11 @@ class MinDalle:
|
|
235 |
dtype=torch.float32,
|
236 |
device=self.device
|
237 |
)
|
|
|
|
|
|
|
238 |
for i in range( IMAGE_TOKEN_COUNT ):
|
|
|
239 |
if(st.session_state.page != 0):
|
240 |
break
|
241 |
st.session_state.bar.progress(i/IMAGE_TOKEN_COUNT)
|
@@ -262,7 +268,12 @@ class MinDalle:
|
|
262 |
is_seamless=is_seamless,
|
263 |
is_verbose=is_verbose
|
264 |
)
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
266 |
|
267 |
|
268 |
|
|
|
12 |
import streamlit as st
|
13 |
import time
|
14 |
|
15 |
+
import tracemalloc
|
16 |
+
|
17 |
torch.set_grad_enabled(False)
|
18 |
torch.set_num_threads(os.cpu_count())
|
19 |
torch.backends.cudnn.enabled = True
|
|
|
237 |
dtype=torch.float32,
|
238 |
device=self.device
|
239 |
)
|
240 |
+
|
241 |
+
tracemalloc.start()
|
242 |
+
|
243 |
for i in range( IMAGE_TOKEN_COUNT ):
|
244 |
+
|
245 |
if(st.session_state.page != 0):
|
246 |
break
|
247 |
st.session_state.bar.progress(i/IMAGE_TOKEN_COUNT)
|
|
|
268 |
is_seamless=is_seamless,
|
269 |
is_verbose=is_verbose
|
270 |
)
|
271 |
+
# displaying the memory
|
272 |
+
print(tracemalloc.get_traced_memory())
|
273 |
+
|
274 |
+
# stopping the library
|
275 |
+
tracemalloc.stop()
|
276 |
+
|
277 |
|
278 |
|
279 |
|