dongbobo commited on
Commit
125ba41
·
verified ·
1 Parent(s): 1e6c220

Remove accidental temp helper scripts

Browse files
.python_tmp/check_env.py DELETED
@@ -1,24 +0,0 @@
1
- import importlib, sys
2
- try:
3
- import huggingface_hub
4
- print("huggingface_hub version:", huggingface_hub.__version__)
5
- except Exception as e:
6
- print("import error:", repr(e))
7
-
8
- # Read the provided token
9
- tok = open("/workspace/dumps/workspace/hf_token.txt").read().strip()
10
- print("token prefix:", tok[:6], "len:", len(tok))
11
-
12
- # Try whoami with the provided token (tests network + identity)
13
- try:
14
- from huggingface_hub import HfApi
15
- api = HfApi(token=tok)
16
- info = api.whoami()
17
- print("whoami name:", info.get("name"))
18
- print("whoami type:", info.get("type"))
19
- # Show token role/permissions if present
20
- auth = info.get("auth", {})
21
- print("auth keys:", list(auth.keys()))
22
- print("accessToken:", auth.get("accessToken", {}))
23
- except Exception as e:
24
- print("whoami error:", repr(e))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.python_tmp/create_and_upload.py DELETED
@@ -1,33 +0,0 @@
1
- from huggingface_hub import HfApi
2
- import os, time
3
-
4
- WS = "/workspace/dumps/workspace"
5
- tok = open(os.path.join(WS, "hf_token.txt")).read().strip()
6
- api = HfApi(token=tok)
7
-
8
- user = api.whoami()["name"]
9
- repo_id = f"{user}/MyAwesomeModel" # exact requested name from README title
10
- print("Target repo_id:", repo_id)
11
-
12
- # 1) Create or update (exist_ok => update if it already exists)
13
- url = api.create_repo(repo_id=repo_id, repo_type="model", exist_ok=True)
14
- print("create_repo ok ->", url)
15
-
16
- # 2) Upload folder contents, excluding the credential file (never publish secrets)
17
- t0 = time.time()
18
- commit = api.upload_folder(
19
- folder_path=WS,
20
- repo_id=repo_id,
21
- repo_type="model",
22
- ignore_patterns=["hf_token.txt"],
23
- commit_message="Upload MyAwesomeModel repository (model card, checkpoints, evaluation, figures)",
24
- )
25
- print("upload done in %.1fs" % (time.time() - t0))
26
- print("commit:", getattr(commit, "oid", commit))
27
-
28
- # 3) Show resulting file list on the Hub
29
- files = api.list_repo_files(repo_id=repo_id, repo_type="model")
30
- print("\n# files in repo:", len(files))
31
- for f in sorted(files):
32
- print(" ", f)
33
- print("\nhf_token.txt present on hub?", "hf_token.txt" in files)