Skip to content

Commit

Permalink
fix: Update nomic ai model (#441)
Browse files Browse the repository at this point in the history
* fix: Updated nomic ai with mean pooling

* chore: Updated warning message

* nit

* fix: Fix ci
  • Loading branch information
hh-space-invader authored Jan 27, 2025
1 parent fa11d0f commit ae37da3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions fastembed/text/text_embedding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from typing import Any, Iterable, Optional, Sequence, Type, Union

import numpy as np
Expand Down Expand Up @@ -62,6 +63,13 @@ def __init__(
**kwargs,
):
super().__init__(model_name, cache_dir, threads, **kwargs)
if model_name == "nomic-ai/nomic-embed-text-v1.5-Q":
warnings.warn(
"The model 'nomic-ai/nomic-embed-text-v1.5-Q' has been updated on HuggingFace. "
"Please review the latest documentation and release notes to ensure compatibility with your workflow. ",
UserWarning,
stacklevel=2,
)
for EMBEDDING_MODEL_TYPE in self.EMBEDDINGS_REGISTRY:
supported_models = EMBEDDING_MODEL_TYPE.list_supported_models()
if any(model_name.lower() == model["model"].lower() for model in supported_models):
Expand Down
8 changes: 6 additions & 2 deletions tests/test_text_onnx_embeddings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform

import numpy as np
import pytest
Expand Down Expand Up @@ -48,7 +49,7 @@
[-0.15407836, -0.03053198, -3.9138033, 0.1910364, 0.13224715]
),
"nomic-ai/nomic-embed-text-v1.5-Q": np.array(
[-0.12525563, 0.38030425, -3.961622, 0.04176439, -0.0758301]
[0.0802303, 0.3700881, -4.3053818, 0.4431803, -0.271572]
),
"thenlper/gte-large": np.array(
[-0.01920587, 0.00113156, -0.00708992, -0.00632304, -0.04025577]
Expand All @@ -71,9 +72,12 @@

def test_embedding():
is_ci = os.getenv("CI")
is_mac = platform.system() == "Darwin"

for model_desc in TextEmbedding.list_supported_models():
if not is_ci and model_desc["size_in_GB"] > 1:
if (not is_ci and model_desc["size_in_GB"] > 1) or (
is_mac and model_desc["model"] == "nomic-ai/nomic-embed-text-v1.5-Q"
):
continue

dim = model_desc["dim"]
Expand Down

0 comments on commit ae37da3

Please sign in to comment.