File size: 1,565 Bytes
5a5a36e
 
 
 
 
 
 
 
 
30ed943
3f45e26
 
 
5a5a36e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fa24f3
5a5a36e
 
 
 
 
 
 
 
 
 
f79e1cd
 
 
5a5a36e
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 = "Intel/low-bit-leaderboard"
QUEUE_REPO = "Intel/ld_requests"
DYNAMIC_INFO_REPO = "Intel/dynamic_model_information"
RESULTS_REPO = "Intel/ld_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 = "xx"

# 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
import threading
GLOBAL_COND = threading.Condition()

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)