Skip to content

Commit

Permalink
Sophiech/update log batch ingestion (#902)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie Chen <[email protected]>
  • Loading branch information
SophieGarden and Sophie Chen committed Jun 3, 2024
1 parent 839ad25 commit f62f3ff
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions scripts/run_batch_create_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import json
import os
from pathlib import Path
import subprocess
import tqdm
from openai import AzureOpenAI
Expand Down Expand Up @@ -29,8 +30,9 @@

}

# change path and embedding models
Path("logs").mkdir(exist_ok=True)
for key, cfg in tqdm.tqdm(run_config_by_data_path_3_small_512_512.items()):
# folder is where data is saved
folder = os.path.join("/index_data", key)

if isinstance(cfg, str):
Expand Down Expand Up @@ -66,14 +68,5 @@
"--njobs=8",
]
str_command = " ".join(command)
proc = subprocess.run(str_command, capture_output=True)
if proc.returncode != 0:
print("Error running", command)
print(proc.stderr)
print(proc.stdout)






with open(f"logs/stdout.{key}.txt", "w") as f_stdout, open(f"logs/stderr.{key}.txt", "w") as f_stderr:
subprocess.run(str_command, stdout=f_stdout, stderr=f_stderr)

0 comments on commit f62f3ff

Please sign in to comment.