in src/text_clustering.py [0:0]
def save(self, folder):
if not os.path.exists(folder):
os.makedirs(folder)
with open(f"{folder}/embeddings.npy", "wb") as f:
np.save(f, self.embeddings)
faiss.write_index(self.faiss_index, f"{folder}/faiss.index")
with open(f"{folder}/projections.npy", "wb") as f:
np.save(f, self.projections)
with open(f"{folder}/cluster_labels.npy", "wb") as f:
np.save(f, self.cluster_labels)
with open(f"{folder}/texts.json", "w") as f:
json.dump(self.texts, f)
with open(f"{folder}/mistral_prompt.txt", "w") as f:
f.write(DEFAULT_INSTRUCTION)
if self.cluster_summaries is not None:
with open(f"{folder}/cluster_summaries.json", "w") as f:
json.dump(self.cluster_summaries, f)