#!/usr/bin/env python3 """ Download HuggingFace models for offline use """ from sentence_transformers import SentenceTransformer from pathlib import Path # Create models directory relative to this script: scripts/ -> ../models/ script_dir = Path(__file__).parent models_dir = script_dir.parent / "models" models_dir.mkdir(parents=True, exist_ok=True) # Download the model model_name = "shibing624/text2vec-base-chinese" model_path = models_dir / "text2vec-base-chinese" print(f"Downloading model: {model_name}") print(f"Saving to: {model_path}") model = SentenceTransformer(model_name) model.save(str(model_path)) print(f"Model successfully downloaded to {model_path}")