EAdd submission names
Browse files
hooks/post_gen_project.py
CHANGED
@@ -3,3 +3,4 @@ import subprocess
|
|
3 |
subprocess.call("git pull origin main".split())
|
4 |
subprocess.call(["git", "add", "."])
|
5 |
subprocess.call(["git", "commit", "-m", "Add template files"])
|
|
|
|
3 |
subprocess.call("git pull origin main".split())
|
4 |
subprocess.call(["git", "add", "."])
|
5 |
subprocess.call(["git", "commit", "-m", "Add template files"])
|
6 |
+
subprocess.call("git push origin main".split())
|
hooks/pre_gen_project.py
CHANGED
@@ -11,7 +11,7 @@ repo_url = HfApi().create_repo(
|
|
11 |
organization=hf_user,
|
12 |
exist_ok=True,
|
13 |
private=True,
|
14 |
-
repo_type="dataset"
|
15 |
)
|
16 |
|
17 |
model_repo = Repository(local_dir=".", clone_from=repo_url, use_auth_token=huggingface_token)
|
|
|
11 |
organization=hf_user,
|
12 |
exist_ok=True,
|
13 |
private=True,
|
14 |
+
repo_type="dataset",
|
15 |
)
|
16 |
|
17 |
model_repo = Repository(local_dir=".", clone_from=repo_url, use_auth_token=huggingface_token)
|
{{cookiecutter.repo_name}}/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
---
|
2 |
benchmark: raft
|
3 |
type: prediction
|
|
|
4 |
---
|
5 |
|
6 |
# RAFT submissions for {{cookiecutter.repo_name}}
|
|
|
1 |
---
|
2 |
benchmark: raft
|
3 |
type: prediction
|
4 |
+
submission_name: none
|
5 |
---
|
6 |
|
7 |
# RAFT submissions for {{cookiecutter.repo_name}}
|
{{cookiecutter.repo_name}}/cli.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import datetime
|
|
|
2 |
import subprocess
|
3 |
from pathlib import Path
|
4 |
|
@@ -23,6 +24,22 @@ CSV_SCHEMA = {
|
|
23 |
app = typer.Typer()
|
24 |
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
@app.command()
|
27 |
def validate():
|
28 |
# TODO(lewtun): Consider using great_expectations for the data validation
|
@@ -69,10 +86,11 @@ def validate():
|
|
69 |
|
70 |
|
71 |
@app.command()
|
72 |
-
def submit():
|
73 |
subprocess.call("git pull origin main".split())
|
74 |
-
|
75 |
-
subprocess.call(["git", "
|
|
|
76 |
subprocess.call(["git", "push"])
|
77 |
|
78 |
today = datetime.date.today()
|
|
|
1 |
import datetime
|
2 |
+
import re
|
3 |
import subprocess
|
4 |
from pathlib import Path
|
5 |
|
|
|
24 |
app = typer.Typer()
|
25 |
|
26 |
|
27 |
+
def _update_submission_name(submission_name: str):
|
28 |
+
replacement = ""
|
29 |
+
with open("README.md", "r") as f:
|
30 |
+
lines = f.readlines()
|
31 |
+
|
32 |
+
for line in lines:
|
33 |
+
if line.startswith("submission_name:"):
|
34 |
+
changes = re.sub(r"submission_name:.+", f"submission_name: {submission_name}", line)
|
35 |
+
replacement += changes
|
36 |
+
else:
|
37 |
+
replacement += line
|
38 |
+
|
39 |
+
with open("README.md", "w") as f:
|
40 |
+
f.write(replacement)
|
41 |
+
|
42 |
+
|
43 |
@app.command()
|
44 |
def validate():
|
45 |
# TODO(lewtun): Consider using great_expectations for the data validation
|
|
|
86 |
|
87 |
|
88 |
@app.command()
|
89 |
+
def submit(submission_name: str = typer.Option(..., prompt="Please provide a name for your submission, e.g. GPT-4 😁")):
|
90 |
subprocess.call("git pull origin main".split())
|
91 |
+
_update_submission_name(submission_name)
|
92 |
+
subprocess.call(["git", "add", "data/*predictions.csv", "README.md"])
|
93 |
+
subprocess.call(["git", "commit", "-m", f"Submission: {submission_name} "])
|
94 |
subprocess.call(["git", "push"])
|
95 |
|
96 |
today = datetime.date.today()
|