Ahmet Kaan Sever commited on
Commit
79a1b57
·
1 Parent(s): 761dc11

Added VRAM and RAM cleanup after request is finished.

Browse files
Files changed (1) hide show
  1. svc/router.py +8 -1
svc/router.py CHANGED
@@ -10,6 +10,7 @@ import os
10
  import json
11
  from src.deepeval.deepeval_task_manager import DeepEvalTaskManager
12
  import torch
 
13
  from time import time
14
  from huggingface_hub import HfApi, ModelInfo
15
 
@@ -111,9 +112,15 @@ async def deep_eval_suite(request: DeepEvalSuiteRequest):
111
  "end_time": end_time
112
  }
113
 
114
-
115
  json_results = json.dumps(tbr_dict)
116
 
 
 
 
 
 
 
 
117
  return TaskResponse(results=json_results)
118
 
119
 
 
10
  import json
11
  from src.deepeval.deepeval_task_manager import DeepEvalTaskManager
12
  import torch
13
+ import gc
14
  from time import time
15
  from huggingface_hub import HfApi, ModelInfo
16
 
 
112
  "end_time": end_time
113
  }
114
 
 
115
  json_results = json.dumps(tbr_dict)
116
 
117
+ #Free up VRAM
118
+ torch.cuda.empty_cache()
119
+
120
+ #Free up RAM
121
+ des = None
122
+ gc.collect()
123
+
124
  return TaskResponse(results=json_results)
125
 
126