File size: 1,492 Bytes
68c95ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os, sys, glob
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER","1")
from huggingface_hub import HfApi, create_repo
P=os.path.expanduser("~/piscina")
tok=open(f"{P}/.hftoken").read().strip()
api=HfApi(token=tok)
MODEL="poolside-laguna-hackathon/Piscina-XS.2-GGUF"
EVAL="poolside-laguna-hackathon/Piscina-XS.2-eval"
mode=sys.argv[1] if len(sys.argv)>1 else "all"
create_repo(MODEL, repo_type="model", exist_ok=True, token=tok)
create_repo(EVAL, repo_type="dataset", exist_ok=True, token=tok)
def up(local, path, repo, rt="model"):
    if not os.path.exists(local): print("skip(absent)",local); return
    print("upload",local,"->",repo,path,flush=True)
    api.upload_file(path_or_fileobj=local, path_in_repo=path, repo_id=repo, repo_type=rt)
if mode in ("meta","all"):
    up(f"{P}/pkg/README.md","README.md",MODEL)
    up(f"{P}/src/author.imatrix","author.imatrix",MODEL)
    up(f"{P}/results/pareto.png","pareto.png",MODEL)
    for s in ["quant.sh","eval.sh","imat.sh","pkg/gen_readme.py","pkg/push.py"]:
        up(f"{P}/{s}", os.path.basename(s), EVAL, "dataset")
    up(f"{P}/results/all.json","all.json",EVAL,"dataset")
    for f in glob.glob(f"{P}/results/*.txt")+glob.glob(f"{P}/results/*.bench.json"):
        up(f, "results/"+os.path.basename(f), EVAL, "dataset")
if mode in ("gguf","all"):
    for g in sorted(glob.glob(f"{P}/out/*.gguf")):
        up(g, os.path.basename(g), MODEL)
if mode.endswith(".gguf"):
    up(f"{P}/out/{mode}", mode, MODEL)
print("PUSH_DONE", mode)