NV-Embed-v2 (Migrated for transformers 5.0+ compatibility)

This is a migrated version of nvidia/NV-Embed-v2 that is compatible with transformers 5.0.0 and later versions.

Changes from Original

The only change made is adding an all_tied_weights_keys property to the NVEmbedModel class in modeling_nvembed.py. This property provides backward compatibility with the transformers library, which changed from using _tied_weights_keys (a class attribute) to all_tied_weights_keys (a property that returns a dict) in version 5.0.0.

The Patch

@property
def all_tied_weights_keys(self):
    """Compatibility property for transformers >= 5.0.0."""
    if hasattr(self, '_tied_weights_keys') and self._tied_weights_keys:
        return {key: key for key in self._tied_weights_keys}
    return {}

Usage

from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("Hyukkyu/nv-embed-v2", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("Hyukkyu/nv-embed-v2", trust_remote_code=True)

Original Model

This model is based on nvidia/NV-Embed-v2. Please refer to the original repository for:

  • Model architecture details
  • Training information
  • Benchmarks and evaluation results
  • Citation information

License

This model inherits the license from the original repository. Please check nvidia/NV-Embed-v2 for license details.

Migration Tool

This model was migrated using the GenZ model migration tool. The migration script is available at: https://github.com/your-repo/GenZ/tree/main/scripts/preprocess/model

Compatibility

  • transformers: >= 5.0.0
  • torch: >= 2.0.0
  • Python: >= 3.9
Downloads last month
51
Safetensors
Model size
8B params
Tensor type
F16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Hyukkyu/nv-embed-v2

Base model

nvidia/NV-Embed-v2
Finetuned
(5)
this model