()
| 34 | |
| 35 | |
| 36 | def main() -> int: |
| 37 | args = parse_args() |
| 38 | dest = Path(args.dest).expanduser() |
| 39 | if not dest.is_absolute(): |
| 40 | dest = (PROJECT_ROOT / dest).resolve() |
| 41 | |
| 42 | dest.parent.mkdir(parents=True, exist_ok=True) |
| 43 | token = os.environ.get("HF_TOKEN") or None |
| 44 | |
| 45 | print(f"Downloading {args.model_id} -> {dest}") |
| 46 | snapshot_download( |
| 47 | repo_id=args.model_id, |
| 48 | local_dir=str(dest), |
| 49 | token=token, |
| 50 | ) |
| 51 | |
| 52 | print("") |
| 53 | print("Done. Add these lines to .env when you want to use the local snapshot:") |
| 54 | print("EMBEDDING_PROVIDER=local") |
| 55 | print(f"LOCAL_EMBEDDING_MODEL_PATH={dest}") |
| 56 | print("LOCAL_EMBEDDING_TRUST_REMOTE_CODE=true") |
| 57 | return 0 |
| 58 | |
| 59 | |
| 60 | if __name__ == "__main__": |
no test coverage detected