Spaces:
Runtime error
Runtime error
Modulized subprocess
Browse files- .gitignore +4 -0
- app.py +20 -11
- requirements.txt +1 -0
.gitignore
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Environment/
|
| 2 |
+
out/
|
| 3 |
+
flagged/
|
| 4 |
+
|
app.py
CHANGED
|
@@ -1,16 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
result = subprocess.run(command, shell=True,capture_output=True, text=True)
|
| 9 |
-
|
| 10 |
-
if result.returncode == 0:
|
| 11 |
-
return result.stdout
|
| 12 |
-
else:
|
| 13 |
-
return f"Error: {result.stderr}"
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
|
| 6 |
+
# Add the path to the "src" directory of detect-pretrain-code-contamination to the sys.path
|
| 7 |
+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "detect-pretrain-code-contamination"))
|
| 8 |
+
src_dir = os.path.join(project_root, "src")
|
| 9 |
+
sys.path.insert(0, src_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
import run as evaluator # Import the run module
|
| 12 |
+
|
| 13 |
+
def evaluate(model):
|
| 14 |
+
return evaluator.main(
|
| 15 |
+
target_model="roneneldan/TinyStories-1M",
|
| 16 |
+
ref_model="roneneldan/TinyStories-Instruct-1M",
|
| 17 |
+
output_dir="out",
|
| 18 |
+
data="truthful_qa",
|
| 19 |
+
length=64,
|
| 20 |
+
key_name="input",
|
| 21 |
+
ratio_gen=0.4
|
| 22 |
+
) # Call the run_main function directly
|
| 23 |
+
|
| 24 |
+
iface = gr.Interface(fn=evaluate, inputs="text", outputs="text")
|
| 25 |
iface.launch()
|
requirements.txt
CHANGED
|
@@ -7,3 +7,4 @@ ipdb
|
|
| 7 |
matplotlib
|
| 8 |
scikit-learn
|
| 9 |
accelerate
|
|
|
|
|
|
| 7 |
matplotlib
|
| 8 |
scikit-learn
|
| 9 |
accelerate
|
| 10 |
+
gradio
|