Dimensionality
#5
by
midesk
- opened
How do I instruct it to use a certain dimensionality? The default is 768.
As a workaround, the following code may be used to reduce the dimensionality from the default response:
def normalize_l2(x):
x = np.array(x)
if x.ndim == 1:
norm = np.linalg.norm(x)
if norm == 0:
return x
return x / norm
else:
norm = np.linalg.norm(x, 2, axis=1, keepdims=True)
return np.where(norm == 0, x, x / norm)
Source: https://platform.openai.com/docs/guides/embeddings/use-cases
Chapter: Reducing embedding dimensions
It would be great if the GGUF version was capable of returning lower dimensions to improve the speed for certain use-cases.