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("")