File size: 1,938 Bytes
e16119c | 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 | # Round 3: forensics — did commits land? does extension matter?
# env var set BEFORE hf import (subprocess-level effect via fresh process).
import os
os.environ["HF_HUB_DISABLE_XET"] = "1" # BEFORE any huggingface_hub import
import time, json, urllib.request
tok = open("/content/qwenjev_work_v3/.hf_token").read().strip()
from huggingface_hub import HfApi
import huggingface_hub
print("hf_hub:", huggingface_hub.__version__, flush=True)
try:
import hf_xet
print("hf_xet present:", getattr(hf_xet, "__version__", "?"), flush=True)
except ImportError:
print("hf_xet: NOT installed", flush=True)
api = HfApi(token=tok)
# ---- 1) recent commits: did test commits actually land? ----------------
commits = list(api.list_repo_commits("tchbcb/qwenjev", repo_type="model"))[:12]
for c in commits:
print("commit:", c.commit_id[:8], c.title[:70], flush=True)
# ---- 2) same 30MB payload, two extensions, no-xet env set pre-import ----
big = os.urandom(30 * 1024 * 1024)
open("/tmp/big.pt", "wb").write(big)
open("/tmp/big.bin", "wb").write(big)
res = {}
for ext in ["pt", "bin"]:
p = "t4_assets_v3/_xet_test/big_noxet." + ext
t0 = time.time()
try:
api.upload_file(path_or_fileobj="/tmp/big." + ext, path_in_repo=p,
repo_id="tchbcb/qwenjev", repo_type="model",
commit_message="xet test E noxet-" + ext)
res[ext] = "up " + str(round(time.time() - t0, 1)) + "s"
except Exception as e:
res[ext] = "ERR " + str(e)[:80]
time.sleep(2)
url = "https://huggingface.co/tchbcb/qwenjev/resolve/main/" + p
try:
r = urllib.request.urlopen(urllib.request.Request(url, method="HEAD"), timeout=30)
res[ext] += " | HEAD OK len=" + str(r.headers.get("Content-Length"))
except Exception as e:
res[ext] += " | HEAD FAIL " + str(e)[:40]
print(ext, "->", res[ext], flush=True)
print("EXPERIMENT3_DONE", flush=True)
|