normalizes averaged embeddings to length 1
This commit is contained in:
parent
14262d47e8
commit
d1165a7757
1 changed files with 1 additions and 0 deletions
|
|
@ -205,6 +205,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
" if average:\n",
|
" if average:\n",
|
||||||
" chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=[len(c) for c in chunk_embeddings]).tolist()\n",
|
" chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=[len(c) for c in chunk_embeddings]).tolist()\n",
|
||||||
|
" chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings) # normalizes length to 1\n",
|
||||||
" return chunk_embeddings"
|
" return chunk_embeddings"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue