lvkaokao
init space.
5a5a36e
raw
history blame
1.7 kB
import os
from huggingface_hub import HfApi
# clone / pull the lmeh eval data
H4_TOKEN = os.environ.get("H4_TOKEN", None)
GIT_TOKEN = os.environ.get("GIT_TOKEN", None)
GIT_REPO = os.environ.get("GIT_REPO", None)
REPO_ID = "HuggingFaceH4/open_llm_leaderboard"
QUEUE_REPO = "lvkaokao/ld_requests"
DYNAMIC_INFO_REPO = "lvkaokao/dynamic_model_information"
RESULTS_REPO = "lvkaokao/ld_results"
PRIVATE_QUEUE_REPO = "open-llm-leaderboard/private-requests"
PRIVATE_RESULTS_REPO = "open-llm-leaderboard/private-results"
IS_PUBLIC = bool(os.environ.get("IS_PUBLIC", True))
# CACHE_PATH=os.getenv("HF_HOME", ".")
CACHE_PATH="./cache_hf"
CACHE_GIT = "cache_git"
EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
GIT_REQUESTS_PATH = os.path.join(CACHE_GIT, "requests")
GIT_STATUS_PATH = os.path.join(CACHE_GIT, "status")
GIT_RESULTS_PATH = os.path.join(CACHE_GIT, "results")
DYNAMIC_INFO_PATH = os.path.join(CACHE_PATH, "dynamic-info")
DYNAMIC_INFO_FILE_PATH = os.path.join(DYNAMIC_INFO_PATH, "model_infos.json")
EVAL_REQUESTS_PATH_PRIVATE = "eval-queue-private"
EVAL_RESULTS_PATH_PRIVATE = "eval-results-private"
PATH_TO_COLLECTION = "lvkaokao/ld-best-models-66139bfb09f16e7347285dc2"
# Rate limit variables
RATE_LIMIT_PERIOD = 20
RATE_LIMIT_QUOTA = 20
HAS_HIGHER_RATE_LIMIT = ["TheBloke"]
API = HfApi(token=H4_TOKEN)
from git import Repo
import os
if not os.path.exists(CACHE_GIT):
REPO = Repo.clone_from(
url=GIT_REPO,
to_path=CACHE_GIT,
)
else:
print("load from local dir.")
REPO = Repo.init(CACHE_GIT)
branch = REPO.active_branch.name
REPO.remotes.origin.pull(branch)