| # script.py | |
| from model2vec.distill import distill | |
| import os | |
| # Set local base model path (already cloned) | |
| LOCAL_MODEL_PATH = os.path.join(os.path.dirname(__file__), "snowflake-arctic-embed-xs") | |
| OUTPUT_PATH = os.path.dirname(os.path.abspath(__file__)) | |
| PCA_DIMS = 256 # You can tweak this | |
| print("Distilling Model2Vec from local model...") | |
| # Distill model | |
| model = distill(model_name=LOCAL_MODEL_PATH, pca_dims=PCA_DIMS) | |
| print("Saving distilled model to:", OUTPUT_PATH) | |
| model.save_pretrained(OUTPUT_PATH) | |
| print("✅ Done. Distilled model saved to", OUTPUT_PATH) |