Spaces:
Running
Running
inoki-giskard
commited on
Commit
·
60a5363
1
Parent(s):
77961b6
Use another process to run scan
Browse files- app.py +23 -39
- cicd/cli.py +2 -2
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
import datasets
|
3 |
import huggingface_hub
|
4 |
-
import sys
|
5 |
import os
|
6 |
import time
|
7 |
-
|
|
|
8 |
|
9 |
import json
|
10 |
|
@@ -154,48 +154,32 @@ def try_validate(model_id, dataset_id, dataset_config, dataset_split, column_map
|
|
154 |
|
155 |
def try_submit(m_id, d_id, config, split, local):
|
156 |
if local:
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
"
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
"loader_id": "huggingface",
|
171 |
-
"model": m_id,
|
172 |
-
"dataset": d_id,
|
173 |
-
"scan_config": None,
|
174 |
-
"dataset_split": split,
|
175 |
-
"dataset_config": config,
|
176 |
-
}
|
177 |
|
178 |
eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
|
179 |
start = time.time()
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
create_discussion_detailed(repo, m_id, d_id, config, split, os.environ.get(HF_WRITE_TOKEN), rendered_report)
|
189 |
-
|
190 |
-
# Cache locally
|
191 |
-
rendered_report = report.to_html()
|
192 |
-
output_dir = Path(f"output/{m_id}/{d_id}/{config}/{split}/")
|
193 |
-
output_dir.mkdir(parents=True, exist_ok=True)
|
194 |
-
with open(output_dir / "report.html", "w") as f:
|
195 |
-
print(f'Writing to {output_dir / "report.html"}')
|
196 |
-
f.write(rendered_report)
|
197 |
|
198 |
-
|
199 |
|
200 |
|
201 |
with gr.Blocks(theme=theme) as iface:
|
|
|
1 |
import gradio as gr
|
2 |
import datasets
|
3 |
import huggingface_hub
|
|
|
4 |
import os
|
5 |
import time
|
6 |
+
import subprocess
|
7 |
+
import logging
|
8 |
|
9 |
import json
|
10 |
|
|
|
154 |
|
155 |
def try_submit(m_id, d_id, config, split, local):
|
156 |
if local:
|
157 |
+
command = [
|
158 |
+
"python",
|
159 |
+
"cli.py",
|
160 |
+
"--loader", "huggingface",
|
161 |
+
"--model", m_id,
|
162 |
+
"--dataset", d_id,
|
163 |
+
"--dataset_config", config,
|
164 |
+
"--dataset_split", split,
|
165 |
+
"--hf_token", os.environ.get(HF_WRITE_TOKEN),
|
166 |
+
"--discussion_repo", os.environ.get(HF_REPO_ID) or os.environ.get(HF_SPACE_ID),
|
167 |
+
"--output_format", "markdown",
|
168 |
+
"--output_portal", "huggingface",
|
169 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
|
172 |
start = time.time()
|
173 |
+
logging.info(f"Start local evaluation on {eval_str}")
|
174 |
|
175 |
+
evaluator = subprocess.Popen(
|
176 |
+
command,
|
177 |
+
cwd=os.path.join(os.path.dirname(os.path.realpath(__file__)), "cicd"),
|
178 |
+
stderr=subprocess.STDOUT,
|
179 |
+
)
|
180 |
+
result = evaluator.wait()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
logging.info(f"Finished local evaluation exit code {result} on {eval_str}: {time.time() - start:.2f}s")
|
183 |
|
184 |
|
185 |
with gr.Blocks(theme=theme) as iface:
|
cicd/cli.py
CHANGED
@@ -3,7 +3,7 @@ import argparse
|
|
3 |
from giskard_cicd.loaders import GithubLoader, HuggingFaceLoader
|
4 |
from giskard_cicd.pipeline.runner import PipelineRunner
|
5 |
|
6 |
-
from automation import
|
7 |
|
8 |
if __name__ == "__main__":
|
9 |
parser = argparse.ArgumentParser(
|
@@ -55,7 +55,7 @@ if __name__ == "__main__":
|
|
55 |
|
56 |
if args.output_portal == "huggingface":
|
57 |
# Push to discussion
|
58 |
-
|
59 |
|
60 |
|
61 |
if args.output:
|
|
|
3 |
from giskard_cicd.loaders import GithubLoader, HuggingFaceLoader
|
4 |
from giskard_cicd.pipeline.runner import PipelineRunner
|
5 |
|
6 |
+
from automation import create_discussion_detailed
|
7 |
|
8 |
if __name__ == "__main__":
|
9 |
parser = argparse.ArgumentParser(
|
|
|
55 |
|
56 |
if args.output_portal == "huggingface":
|
57 |
# Push to discussion
|
58 |
+
create_discussion_detailed(args.discussion_repo, args.model, args.dataset, args.dataset_config, args.dataset_split, args.hf_token, rendered_report)
|
59 |
|
60 |
|
61 |
if args.output:
|