48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
"""Which repos can we actually DOWNLOAD from?
|
|
|
|
`model_info` succeeds on a gated repo you have not been granted, so it is not a
|
|
usable test. Fetching a real file is.
|
|
"""
|
|
import os
|
|
|
|
from huggingface_hub import hf_hub_download
|
|
|
|
CANDIDATES = [
|
|
("ai4bharat/indic-conformer-600m-multilingual", "Indic ASR (22 languages)"),
|
|
("ai4bharat/indic-parler-tts", "Indic TTS (21 languages)"),
|
|
("openai/whisper-small", "English ASR + language ID"),
|
|
("ai4bharat/indic-parler-tts-pretrained", "TTS base (fallback)"),
|
|
("ai4bharat/indicconformer_stt_ta_hybrid_rnnt_large", "Tamil-only ASR (fallback)"),
|
|
]
|
|
|
|
token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
|
print(f"token present: {bool(token)}\n")
|
|
print(f"{'repo':52} {'what it is':30} status")
|
|
print("-" * 108)
|
|
|
|
blocked = []
|
|
for repo, what in CANDIDATES:
|
|
try:
|
|
hf_hub_download(repo_id=repo, filename="config.json", token=token)
|
|
print(f"{repo:52} {what:30} DOWNLOADABLE")
|
|
except Exception as e: # noqa: BLE001
|
|
msg = str(e)
|
|
if "not in the authorized list" in msg or "403" in msg:
|
|
print(f"{repo:52} {what:30} NEEDS ACCESS — click 'Agree' on the model page")
|
|
blocked.append(repo)
|
|
elif "401" in msg or "restricted" in msg:
|
|
print(f"{repo:52} {what:30} NOT AUTHENTICATED")
|
|
blocked.append(repo)
|
|
elif "404" in msg or "EntryNotFound" in msg:
|
|
# No config.json at the root, but the repo itself is reachable.
|
|
print(f"{repo:52} {what:30} reachable (no config.json)")
|
|
else:
|
|
print(f"{repo:52} {what:30} ERROR {msg[:34]}")
|
|
|
|
if blocked:
|
|
print("\nGrant access here (sign in, click 'Agree and access repository'):")
|
|
for repo in blocked:
|
|
print(f" https://huggingface.co/{repo}")
|
|
else:
|
|
print("\nAll required models are downloadable.")
|