"""Download CLIP BPE merges.txt for ANSSAM3 tokenizer."""
import urllib.request
import sys
import os

URL = "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt"

def main():
    out_dir = sys.argv[1] if len(sys.argv) > 1 else os.path.dirname(os.path.abspath(__file__))
    out_path = os.path.join(out_dir, "merges.txt")

    print(f"Downloading merges.txt to {out_path} ...")
    urllib.request.urlretrieve(URL, out_path)
    print(f"Done ({os.path.getsize(out_path)} bytes)")

if __name__ == "__main__":
    main()
