hylee
commited on
Commit
·
bb5a6f1
1
Parent(s):
7841567
get rid of del for models
Browse files- handler.py +19 -19
handler.py
CHANGED
@@ -261,13 +261,13 @@ class EndpointHandler():
|
|
261 |
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
262 |
logger.info(f"Used Memory after model 1 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
263 |
logger.info(f"CPU Usage after model 1 loaded: {cpu_percent}%")
|
264 |
-
del uptake_model
|
265 |
-
cpu_percent = psutil.cpu_percent()
|
266 |
-
mem_info = psutil.virtual_memory()
|
267 |
-
used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
268 |
-
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
269 |
-
logger.info(f"Used Memory after model 1 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
270 |
-
logger.info(f"CPU Usage after model 1 deleted: {cpu_percent}%")
|
271 |
# Reasoning
|
272 |
reasoning_model = ReasoningModel(
|
273 |
self.device, self.tokenizer, self.input_builder)
|
@@ -279,13 +279,13 @@ class EndpointHandler():
|
|
279 |
logger.info(f"Used Memory after model 2 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
280 |
logger.info(f"CPU Usage after model 2 loaded: {cpu_percent}%")
|
281 |
# print(f"CPU Usage after model 2 loaded: {cpu_percent}%")
|
282 |
-
del reasoning_model
|
283 |
cpu_percent = psutil.cpu_percent()
|
284 |
-
mem_info = psutil.virtual_memory()
|
285 |
-
used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
286 |
-
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
287 |
-
logger.info(f"Used Memory after model 2 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
288 |
-
logger.info(f"CPU Usage after model 2 deleted: {cpu_percent}%")
|
289 |
# print(f"CPU Usage after model 2 deleted: {cpu_percent}%")
|
290 |
# Question
|
291 |
question_model = QuestionModel(
|
@@ -298,12 +298,12 @@ class EndpointHandler():
|
|
298 |
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
299 |
logger.info(f"Used Memory after model 3 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
300 |
# print(f"CPU Usage after model 3 loaded: {cpu_percent}%")
|
301 |
-
del question_model
|
302 |
cpu_percent = psutil.cpu_percent()
|
303 |
-
logger.info(f"CPU Usage after model 3 deleted: {cpu_percent}%")
|
304 |
-
mem_info = psutil.virtual_memory()
|
305 |
-
used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
306 |
-
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
307 |
-
logger.info(f"Used Memory after model 3 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
308 |
# print(f"CPU Usage after model 3 deleted: {cpu_percent}%")
|
309 |
return transcript.to_dict()
|
|
|
261 |
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
262 |
logger.info(f"Used Memory after model 1 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
263 |
logger.info(f"CPU Usage after model 1 loaded: {cpu_percent}%")
|
264 |
+
# del uptake_model
|
265 |
+
# cpu_percent = psutil.cpu_percent()
|
266 |
+
# mem_info = psutil.virtual_memory()
|
267 |
+
# used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
268 |
+
# total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
269 |
+
# logger.info(f"Used Memory after model 1 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
270 |
+
# logger.info(f"CPU Usage after model 1 deleted: {cpu_percent}%")
|
271 |
# Reasoning
|
272 |
reasoning_model = ReasoningModel(
|
273 |
self.device, self.tokenizer, self.input_builder)
|
|
|
279 |
logger.info(f"Used Memory after model 2 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
280 |
logger.info(f"CPU Usage after model 2 loaded: {cpu_percent}%")
|
281 |
# print(f"CPU Usage after model 2 loaded: {cpu_percent}%")
|
282 |
+
# del reasoning_model
|
283 |
cpu_percent = psutil.cpu_percent()
|
284 |
+
# mem_info = psutil.virtual_memory()
|
285 |
+
# used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
286 |
+
# total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
287 |
+
# logger.info(f"Used Memory after model 2 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
288 |
+
# logger.info(f"CPU Usage after model 2 deleted: {cpu_percent}%")
|
289 |
# print(f"CPU Usage after model 2 deleted: {cpu_percent}%")
|
290 |
# Question
|
291 |
question_model = QuestionModel(
|
|
|
298 |
total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
299 |
logger.info(f"Used Memory after model 3 loaded: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
300 |
# print(f"CPU Usage after model 3 loaded: {cpu_percent}%")
|
301 |
+
# del question_model
|
302 |
cpu_percent = psutil.cpu_percent()
|
303 |
+
# logger.info(f"CPU Usage after model 3 deleted: {cpu_percent}%")
|
304 |
+
# mem_info = psutil.virtual_memory()
|
305 |
+
# used_mem = mem_info.used / (1024 ** 3) # Convert to gigabytes
|
306 |
+
# total_mem = mem_info.total / (1024 ** 3) # Convert to gigabytes
|
307 |
+
# logger.info(f"Used Memory after model 3 deleted: {used_mem:.2f} GB, Total Mem: {total_mem:.2f} GB")
|
308 |
# print(f"CPU Usage after model 3 deleted: {cpu_percent}%")
|
309 |
return transcript.to_dict()
|