File size: 671 Bytes
2e175db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Pre-download CLIP weights to the HuggingFace cache.

Run during Docker image build or first deploy so the first user-facing
request isn't blocked by a multi-hundred-MB download.

Usage
-----
    python scripts/download_weights.py
"""
from __future__ import annotations


def main() -> None:
    from transformers import CLIPModel, CLIPProcessor

    from deepfake_scanner.config import settings

    name = settings.clip_model_name
    print(f"Downloading {name} (Apache-2.0 transformers, MIT-licensed weights)...")
    CLIPProcessor.from_pretrained(name)
    CLIPModel.from_pretrained(name)
    print("Done. Weights cached.")


if __name__ == "__main__":
    main()