in 1_synthetic-qa-generation/reasoningplaning/evolve.py [0:0]
def createPrompts(self):
logger.info("Creating %d prompts." % self.num_rows)
assert self.seed_text_dict, "must have seed text list"
t0 = time.time()
self.prompts.clear()
# for i in range(self.num_rows):
# new_prompt = np.random.choice(self.seed_text_dict)
# self.prompts.append(new_prompt)
#@#FORTST comment above and replaced by below
self.num_rows = len(self.seed_text_dict)
for new_prompt in self.seed_text_dict:
# self.prompts.append(new_prompt)
self.prompts[new_prompt] = {
"idx": self.seed_text_dict[new_prompt]["idx"],
GRND_TRUTH_COL: self.seed_text_dict[new_prompt][GRND_TRUTH_COL]
}
i = 0
logger.info(f"length of self prompts={len(self.prompts)}")
while self.mutate(i):
logger.info("Iteration: %d" % i)
i += 1
if i >= MAX_ITERATIONS:
logger.info("Reached maximum number of iterations.")
break
t1 = time.time()
logger.info("Done creating %d prompts in %.4f seconds." % (len(self.final_prompts), t1 - t0))
#@# include the original prompt into final_prompts
for k in self.seed_text_dict:
self.final_prompts[k] = {
"idx": self.seed_text_dict[k]["idx"],
"preidx": int(-100),
"preproblem": "",
GRND_TRUTH_COL: self.seed_text_dict[k][GRND_TRUTH_COL]
}