wikipedia-ja-20231030 / all_embs_to_faiss.py
hotchpotch's picture
Add script to generate all embeddings and update
0fb0a80
raw
history blame
485 Bytes
from pathlib import Path
import sys
import os
all_args_str = ' '.join(sys.argv[1:])
target_pathes = list(Path("./embs/").glob("**/*.npz"))
target_pathes = list(map(lambda x: x.parent, target_pathes))
# unique
target_pathes = list(set(target_pathes))
for target_path in target_pathes:
name = target_path.parent.stem
target = target_path.stem
cmd = f"python embs_to_faiss.py -t {target} -i {name} {all_args_str}"
print(f"[run] {cmd}")
os.system(cmd)
print("")