Open hp0404 opened 3 months ago
I humbly submit my heinous hack. I suspect when local instead of global is used, some lists of all zero weight elements come under consideration. The attempt to normalize their zero weight contributions fails and the np.average ZeroDivisionError occurs. I put a try block in the embedding.py code like this:
try:
chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens)
chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings)
except ZeroDivisionError:
return [] # return empty list
return chunk_embeddings.tolist() # would always work in global
Seems to work.
I humbly submit my heinous hack. I suspect when local instead of global is used, some lists of all zero weight elements come under consideration. The attempt to normalize their zero weight contributions fails and the np.average ZeroDivisionError occurs. I put a try block in the embedding.py code like this:
Daves hack to avoid divide by zero
try: chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens) chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings) except ZeroDivisionError: return [] # return empty list return chunk_embeddings.tolist() # would always work in global
Seems to work.
This seems to generate completely out of context response
I encountered the following problem while running a local search from Google Colab:
command:
output:
now, when running a global search, it responds without errors:
The entire indexing pipeline ran without issues, too (I pulled the 'nomic_embed_text' model, and it seems to work? I'm not sure what the error message is about).
config: