Spaces:
Runtime error
Runtime error
Added ability to wipe the logs from the system status page
Browse files- pages/900_System_Status.py +7 -0
- src/architectures.py +22 -0
pages/900_System_Status.py
CHANGED
@@ -3,11 +3,18 @@ from time import sleep
|
|
3 |
|
4 |
from src.st_helpers import st_setup
|
5 |
from src.common import *
|
|
|
6 |
|
7 |
|
8 |
if st_setup('LLM Arch'):
|
9 |
st.write("# System Status")
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
st.write("## HF Inference Endpoint Statuses")
|
12 |
st.write("The following endpoints need to be running to run all the demonstrations.")
|
13 |
|
|
|
3 |
|
4 |
from src.st_helpers import st_setup
|
5 |
from src.common import *
|
6 |
+
from src.architectures import Architecture
|
7 |
|
8 |
|
9 |
if st_setup('LLM Arch'):
|
10 |
st.write("# System Status")
|
11 |
|
12 |
+
st.write("## Wipe Trace Logs")
|
13 |
+
if st.button("Wipe logs"):
|
14 |
+
Architecture.wipe_trace()
|
15 |
+
|
16 |
+
st.divider()
|
17 |
+
|
18 |
st.write("## HF Inference Endpoint Statuses")
|
19 |
st.write("The following endpoints need to be running to run all the demonstrations.")
|
20 |
|
src/architectures.py
CHANGED
@@ -8,6 +8,7 @@ import json
|
|
8 |
import os
|
9 |
import regex as re
|
10 |
import requests
|
|
|
11 |
import traceback
|
12 |
|
13 |
from abc import ABC, abstractmethod
|
@@ -197,6 +198,27 @@ class Architecture:
|
|
197 |
save_repo = None
|
198 |
save_repo_load_error = False
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
@classmethod
|
201 |
def load_architectures(cls, force_reload: bool = False) -> None:
|
202 |
"""
|
|
|
8 |
import os
|
9 |
import regex as re
|
10 |
import requests
|
11 |
+
import shutil
|
12 |
import traceback
|
13 |
|
14 |
from abc import ABC, abstractmethod
|
|
|
198 |
save_repo = None
|
199 |
save_repo_load_error = False
|
200 |
|
201 |
+
@classmethod
|
202 |
+
def wipe_trace(cls):
|
203 |
+
repo_url = "https://huggingface.co/datasets/alfraser/llm-arch-trace"
|
204 |
+
trace_dir = "trace"
|
205 |
+
trace_file_name = "trace.json"
|
206 |
+
data_file = os.path.join(trace_dir, trace_file_name)
|
207 |
+
if os.path.exists(trace_dir):
|
208 |
+
shutil.rmtree(trace_dir)
|
209 |
+
|
210 |
+
try:
|
211 |
+
hf_write_token = hf_api_token(write=True)
|
212 |
+
Architecture.save_repo = Repository(local_dir=trace_dir, clone_from=repo_url, token=hf_write_token)
|
213 |
+
test_json = {'tests': []}
|
214 |
+
with open(data_file, 'w') as f:
|
215 |
+
json.dump(test_json, f, indent=2)
|
216 |
+
Architecture.save_repo.push_to_hub()
|
217 |
+
except Exception as err:
|
218 |
+
Architecture.save_repo_load_error = True
|
219 |
+
print(f"Error connecting to the save repo {err} - persistence now disabled")
|
220 |
+
|
221 |
+
|
222 |
@classmethod
|
223 |
def load_architectures(cls, force_reload: bool = False) -> None:
|
224 |
"""
|