nv-embed-v2 / README.md
Hyukkyu's picture
Upload migrated model for transformers 5.0+ compatibility
005478f verified
---
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