Spaces:
Runtime error
Runtime error
rename hf token var
Browse files- app.py +3 -3
- src/envs.py +2 -2
- src/submission/submit.py +3 -3
app.py
CHANGED
|
@@ -25,7 +25,7 @@ from src.display.utils import (
|
|
| 25 |
Precision,
|
| 26 |
generate_column_name
|
| 27 |
)
|
| 28 |
-
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO,
|
| 29 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
| 30 |
from src.submission.submit import add_new_eval
|
| 31 |
from dotenv import load_dotenv
|
|
@@ -40,14 +40,14 @@ def restart_space():
|
|
| 40 |
try:
|
| 41 |
print(EVAL_REQUESTS_PATH)
|
| 42 |
snapshot_download(
|
| 43 |
-
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=
|
| 44 |
)
|
| 45 |
except Exception:
|
| 46 |
restart_space()
|
| 47 |
try:
|
| 48 |
print(EVAL_RESULTS_PATH)
|
| 49 |
snapshot_download(
|
| 50 |
-
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=
|
| 51 |
)
|
| 52 |
except Exception:
|
| 53 |
restart_space()
|
|
|
|
| 25 |
Precision,
|
| 26 |
generate_column_name
|
| 27 |
)
|
| 28 |
+
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, HF_TOKEN
|
| 29 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
| 30 |
from src.submission.submit import add_new_eval
|
| 31 |
from dotenv import load_dotenv
|
|
|
|
| 40 |
try:
|
| 41 |
print(EVAL_REQUESTS_PATH)
|
| 42 |
snapshot_download(
|
| 43 |
+
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=HF_TOKEN
|
| 44 |
)
|
| 45 |
except Exception:
|
| 46 |
restart_space()
|
| 47 |
try:
|
| 48 |
print(EVAL_RESULTS_PATH)
|
| 49 |
snapshot_download(
|
| 50 |
+
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=HF_TOKEN
|
| 51 |
)
|
| 52 |
except Exception:
|
| 53 |
restart_space()
|
src/envs.py
CHANGED
|
@@ -4,7 +4,7 @@ from huggingface_hub import HfApi
|
|
| 4 |
|
| 5 |
# Info to change for your repository
|
| 6 |
# ----------------------------------
|
| 7 |
-
|
| 8 |
|
| 9 |
OWNER = "TemryL" # Change to your org - don't forget to create a results and request dataset, with the correct format!
|
| 10 |
# ----------------------------------
|
|
@@ -22,4 +22,4 @@ EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
|
|
| 22 |
EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
|
| 23 |
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
|
| 24 |
|
| 25 |
-
API = HfApi(token=
|
|
|
|
| 4 |
|
| 5 |
# Info to change for your repository
|
| 6 |
# ----------------------------------
|
| 7 |
+
HF_TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
|
| 8 |
|
| 9 |
OWNER = "TemryL" # Change to your org - don't forget to create a results and request dataset, with the correct format!
|
| 10 |
# ----------------------------------
|
|
|
|
| 22 |
EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
|
| 23 |
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
|
| 24 |
|
| 25 |
+
API = HfApi(token=HF_TOKEN)
|
src/submission/submit.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
|
| 5 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 6 |
-
from src.envs import API, EVAL_REQUESTS_PATH,
|
| 7 |
from src.submission.check_validity import (
|
| 8 |
already_submitted_models,
|
| 9 |
check_model_card,
|
|
@@ -45,12 +45,12 @@ def add_new_eval(
|
|
| 45 |
|
| 46 |
# Is the model on the hub?
|
| 47 |
if weight_type in ["Delta", "Adapter"]:
|
| 48 |
-
base_model_on_hub, error, _ = is_model_on_hub(model_name=base_model, revision=revision, token=
|
| 49 |
if not base_model_on_hub:
|
| 50 |
return styled_error(f'Base model "{base_model}" {error}')
|
| 51 |
|
| 52 |
if not weight_type == "Adapter":
|
| 53 |
-
model_on_hub, error, _ = is_model_on_hub(model_name=model, revision=revision, token=
|
| 54 |
if not model_on_hub:
|
| 55 |
return styled_error(f'Model "{model}" {error}')
|
| 56 |
|
|
|
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
|
| 5 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 6 |
+
from src.envs import API, EVAL_REQUESTS_PATH, HF_TOKEN, QUEUE_REPO
|
| 7 |
from src.submission.check_validity import (
|
| 8 |
already_submitted_models,
|
| 9 |
check_model_card,
|
|
|
|
| 45 |
|
| 46 |
# Is the model on the hub?
|
| 47 |
if weight_type in ["Delta", "Adapter"]:
|
| 48 |
+
base_model_on_hub, error, _ = is_model_on_hub(model_name=base_model, revision=revision, token=HF_TOKEN, test_tokenizer=True)
|
| 49 |
if not base_model_on_hub:
|
| 50 |
return styled_error(f'Base model "{base_model}" {error}')
|
| 51 |
|
| 52 |
if not weight_type == "Adapter":
|
| 53 |
+
model_on_hub, error, _ = is_model_on_hub(model_name=model, revision=revision, token=HF_TOKEN, test_tokenizer=True)
|
| 54 |
if not model_on_hub:
|
| 55 |
return styled_error(f'Model "{model}" {error}')
|
| 56 |
|