Instructions to use nvidia/NV-Embed-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/NV-Embed-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="nvidia/NV-Embed-v2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/NV-Embed-v2", trust_remote_code=True, dtype="auto") - sentence-transformers
How to use nvidia/NV-Embed-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("nvidia/NV-Embed-v2", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
TypeError: cannot unpack non-iterable NoneType object
I found that running with the latest version of transformers==4.48.1 runs into an error: TypeError: cannot unpack non-iterable NoneType object. Downgrading to 4.42.4 solved the issue
Will there be support for the latest versions of transformers? Thanks!
Hi. We suggest users to follow the install package version as follows: https://huggingface.co/nvidia/NV-Embed-v2#2-required-packages
I was facing same issue what shall i do
I encountered the same error. Previously, I was using transformers version 4.49.0. After downgrading to version 4.46.2, the issue was resolved.
Hi. We suggest users to follow the install package version as follows: https://huggingface.co/nvidia/NV-Embed-v2#2-required-packages
thank you very much, I tried to fix this bug for so long