meet4150/ALIV_AI / scripts /download_hf_chat_model.py
download
raw
1.18 kB
from __future__ import annotations
import subprocess
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
MODELS_DIR = PROJECT_ROOT / "models" / "google__flan-t5-small"
MODEL_REPO = "google/flan-t5-small"
REQUIRED_FILES = [
"config.json",
"generation_config.json",
"special_tokens_map.json",
"spiece.model",
"tokenizer.json",
"tokenizer_config.json",
"model.safetensors",
]
def download_file(relative_path: str) -> None:
destination = MODELS_DIR / relative_path
destination.parent.mkdir(parents=True, exist_ok=True)
if destination.exists():
print(f"Skipping existing file: {destination}")
return
url = f"https://huggingface.co/{MODEL_REPO}/resolve/main/{relative_path}"
print(f"Downloading {MODEL_REPO}/{relative_path}")
subprocess.run(
["curl", "-L", "--fail", url, "-o", str(destination)],
check=True,
)
def main() -> None:
MODELS_DIR.mkdir(parents=True, exist_ok=True)
for file_name in REQUIRED_FILES:
download_file(file_name)
print("Hugging Face chat fallback model downloaded successfully.")
if __name__ == "__main__":
main()

Xet Storage Details

Size:
1.18 kB
·
Xet hash:
861ed0aff935d4c98466e3b168a2da8b06f6dc10152f949c7fa4e02fe3cd7c1b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.