raptor
raptor copied to clipboard
UMAP n_neighbors must be greater than 1
Hi team, currently I am building with raptor to achieve the open-domain QA as following: we have data stored as question-answer pair, and when user have a input query, I try to match the query with top-k most related questions asked in my data and concatenate their answer, and then use raptor to try to get a answer for the input query, but when the length of docs in RA.add_documents(docs) gets longer, it gives me "n_neighbors must be greater than 1" error for UMAP part at fit transform in this code chunk: def global_cluster_embeddings( embeddings: np.ndarray, dim: int, n_neighbors: Optional[int] = None, metric: str = "cosine", ) -> np.ndarray: if n_neighbors is None: n_neighbors = int((len(embeddings) - 1) ** 0.5) reduced_embeddings = umap.UMAP( n_neighbors=n_neighbors, n_components=dim, metric=metric ).fit_transform(embeddings) return reduced_embeddings Is there any way to resolve UMAP issue in this case?