Commit
•
b2a9c22
1
Parent(s):
80a2042
Adding better logs
Browse files- app.py +3 -0
- main_backend_lighteval.py +3 -0
- src/logging.py +13 -29
app.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import logging
|
2 |
|
3 |
import gradio as gr
|
|
|
1 |
+
from src.logging import configure_root_logger
|
2 |
+
configure_root_logger()
|
3 |
+
|
4 |
import logging
|
5 |
|
6 |
import gradio as gr
|
main_backend_lighteval.py
CHANGED
@@ -70,6 +70,7 @@ def run_auto_eval():
|
|
70 |
# instance_size, instance_type = "small", "g4dn.xlarge"
|
71 |
# For CPU
|
72 |
instance_size, instance_type = "medium", "c6i"
|
|
|
73 |
|
74 |
run_evaluation(
|
75 |
eval_request=eval_request,
|
@@ -84,6 +85,8 @@ def run_auto_eval():
|
|
84 |
limit=LIMIT
|
85 |
)
|
86 |
|
|
|
|
|
87 |
|
88 |
if __name__ == "__main__":
|
89 |
run_auto_eval()
|
|
|
70 |
# instance_size, instance_type = "small", "g4dn.xlarge"
|
71 |
# For CPU
|
72 |
instance_size, instance_type = "medium", "c6i"
|
73 |
+
logger.info(f'Starting Evaluation of {eval_request.json_filepath} on Inference endpoints: {instance_size} {instance_type}')
|
74 |
|
75 |
run_evaluation(
|
76 |
eval_request=eval_request,
|
|
|
85 |
limit=LIMIT
|
86 |
)
|
87 |
|
88 |
+
logger.info(f'Completed Evaluation of {eval_request.json_filepath} on Inference endpoints: {instance_size} {instance_type}')
|
89 |
+
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
run_auto_eval()
|
src/logging.py
CHANGED
@@ -23,32 +23,16 @@ def setup_logger(name: str):
|
|
23 |
|
24 |
return logger
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
# def isatty(self):
|
40 |
-
# return False
|
41 |
-
#
|
42 |
-
# def read_logs():
|
43 |
-
# sys.stdout.flush()
|
44 |
-
# #API.upload_file(
|
45 |
-
# # path_or_fileobj="output.log",
|
46 |
-
# # path_in_repo="demo-backend.log",
|
47 |
-
# # repo_id="demo-leaderboard-backend/logs",
|
48 |
-
# # repo_type="dataset",
|
49 |
-
# #)
|
50 |
-
#
|
51 |
-
# with open(log_file, "r") as f:
|
52 |
-
# return f.read()
|
53 |
-
#
|
54 |
-
# LOGGER = Logger()
|
|
|
23 |
|
24 |
return logger
|
25 |
|
26 |
+
|
27 |
+
def configure_root_logger():
|
28 |
+
# Configure the root logger
|
29 |
+
logging.basicConfig(level=logging.INFO)
|
30 |
+
root_logger = logging.getLogger()
|
31 |
+
|
32 |
+
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
33 |
+
|
34 |
+
file_handler = logging.FileHandler(log_file)
|
35 |
+
file_handler.setLevel(logging.INFO)
|
36 |
+
file_handler.setFormatter(formatter)
|
37 |
+
|
38 |
+
root_logger.addHandler(file_handler)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|