File size: 1,975 Bytes
005478f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ---
license: cc-by-nc-4.0
library_name: transformers
tags:
- nv-embed
- embedding
- retrieval
- transformers
base_model: nvidia/NV-Embed-v2
---
# NV-Embed-v2 (Migrated for transformers 5.0+ compatibility)
This is a migrated version of [nvidia/NV-Embed-v2](https://huggingface.co/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
```python
@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
```python
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](https://huggingface.co/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](https://huggingface.co/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
|