def METHOD_NAME():
    parser = get_parser()
    args = parser.parse_args()
    try:
        faiss_spec = parse_faiss_specs(args.faiss_specs.rstrip("/"))[0]
    except Exception:
        print(spec)
        raise
    print("Faiss Spec:", faiss_spec, file=sys.stderr)
    if faiss_spec.pca:
        A = torch.from_numpy(np.load(osp.join(args.model_path, "pca_A.npy"))).cuda()
        b = torch.from_numpy(np.load(osp.join(args.model_path, "pca_b.npy"))).cuda()
        print("Loaded PCA", file=sys.stderr)
    centroids = np.load(osp.join(args.model_path, "centroids.npy"))
    print("Loaded centroids", centroids.shape, file=sys.stderr)
    res = faiss.StandardGpuResources()
    index_flat = (
        faiss.IndexFlatL2(centroids.shape[1])
        if not faiss_spec.sphere
        else faiss.IndexFlatIP(centroids.shape[1])
    )
    faiss_index = faiss.index_cpu_to_gpu(res, 0, index_flat)
    faiss_index.add(centroids)
    generator, num = get_iterator(args)
    iterator = generator()
    if not osp.exists(args.output_path):
        os.makedirs(args.output_path)
    had_labels = False
    label_path = osp.join(args.output_path, f"{args.split}.{args.labels}")
    output_cluster = f"{args.output_path}/{args.split}.cluster"
    with torch.no_grad():
        with open(output_cluster, "w") as oc, open(label_path, "w") as lp:
            for f, fname, lbl in tqdm.tqdm(iterator, total=num):
                if faiss_spec.pca:
                    f = torch.mm(f, A) + b
                if faiss_spec.norm:
                    f = F.normalize(f, p=2, dim=-1)
                _, z = faiss_index.search(f, 1)
                cluster = f"{args.delimiter}".join(str(x.item()) for x in z)
                oc.write(f"{fname} {cluster}\n")
                if lbl is not None:
                    print(lbl, file=lp)
                    had_labels = True
    if not had_labels:
        os.remove(label_path)