Update init.py
Browse files
init.py
CHANGED
@@ -4,8 +4,10 @@ from pathlib import Path
|
|
4 |
from huggingface_hub import HfApi, Repository
|
5 |
|
6 |
TOKEN_HUB = os.environ.get("TOKEN_HUB", None)
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
|
10 |
hf_api = HfApi(
|
11 |
endpoint="https://huggingface.co",
|
@@ -22,26 +24,35 @@ def load_all_info_from_dataset_hub():
|
|
22 |
else:
|
23 |
print("Pulling evaluation requests and results.")
|
24 |
|
25 |
-
|
26 |
-
local_dir=
|
27 |
-
clone_from=
|
28 |
use_auth_token=TOKEN_HUB,
|
29 |
repo_type="dataset",
|
30 |
)
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# Local directory where dataset repo is cloned + folder with eval requests
|
34 |
-
directory =
|
35 |
requested_models = get_all_requested_models(directory)
|
36 |
requested_models = [p.stem for p in requested_models]
|
37 |
# Local directory where dataset repo is cloned
|
38 |
-
|
39 |
-
|
|
|
40 |
passed = False
|
41 |
if not passed:
|
42 |
raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
|
43 |
|
44 |
-
return
|
45 |
|
46 |
|
47 |
def upload_file(requested_model_name, path_or_fileobj):
|
|
|
4 |
from huggingface_hub import HfApi, Repository
|
5 |
|
6 |
TOKEN_HUB = os.environ.get("TOKEN_HUB", None)
|
7 |
+
QUEUE_REPO_EDACC = os.environ.get("QUEUE_REPO_EDACC", None)
|
8 |
+
QUEUE_REPO_AFRI = os.environ.get("QUEUE_REPO_AFRI", None)
|
9 |
+
QUEUE_PATH_EDACC = os.environ.get("QUEUE_PATH", None)
|
10 |
+
QUEUE_PATH_AFRI = os.environ.get("QUEUE_PATH", None)
|
11 |
|
12 |
hf_api = HfApi(
|
13 |
endpoint="https://huggingface.co",
|
|
|
24 |
else:
|
25 |
print("Pulling evaluation requests and results.")
|
26 |
|
27 |
+
eval_queue_repo_edacc = Repository(
|
28 |
+
local_dir=QUEUE_PATH_EDACC,
|
29 |
+
clone_from=QUEUE_REPO_EDACC,
|
30 |
use_auth_token=TOKEN_HUB,
|
31 |
repo_type="dataset",
|
32 |
)
|
33 |
+
eval_queue_repo_edacc.git_pull()
|
34 |
+
|
35 |
+
eval_queue_repo_afrispeech = Repository(
|
36 |
+
local_dir=QUEUE_PATH_AFRI,
|
37 |
+
clone_from=QUEUE_REPO_AFRI,
|
38 |
+
use_auth_token=TOKEN_HUB,
|
39 |
+
repo_type="dataset",
|
40 |
+
)
|
41 |
+
eval_queue_repo_afrispeech.git_pull()
|
42 |
|
43 |
# Local directory where dataset repo is cloned + folder with eval requests
|
44 |
+
directory = QUEUE_PATH_EDACC / EVAL_REQUESTS_PATH
|
45 |
requested_models = get_all_requested_models(directory)
|
46 |
requested_models = [p.stem for p in requested_models]
|
47 |
# Local directory where dataset repo is cloned
|
48 |
+
csv_results_edacc = get_csv_with_results(QUEUE_PATH_EDACC)
|
49 |
+
csv_results_afrispeech = get_csv_with_results(QUEUE_PATH_AFRI)
|
50 |
+
if csv_results_edacc is None or csv_results_afrispeech is None:
|
51 |
passed = False
|
52 |
if not passed:
|
53 |
raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
|
54 |
|
55 |
+
return eval_queue_repo_edacc, requested_models, csv_results_edacc, csv_results_afrispeech
|
56 |
|
57 |
|
58 |
def upload_file(requested_model_name, path_or_fileobj):
|