Remove ` (default)` from MTEB metadata
#1
by
tomaarsen
HF staff
- opened
- README.md +5 -7
- config.json +2 -2
- configuration_nvembed.py +0 -2
README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
---
|
2 |
tags:
|
3 |
- mteb
|
4 |
-
- sentence-transformers
|
5 |
model-index:
|
6 |
- name: NV-Embed-v2
|
7 |
results:
|
@@ -2004,10 +2003,9 @@ model-index:
|
|
2004 |
language:
|
2005 |
- en
|
2006 |
license: cc-by-nc-4.0
|
2007 |
-
library_name: transformers
|
2008 |
---
|
2009 |
## Introduction
|
2010 |
-
We present NV-Embed-v2, a generalist embedding model that ranks No. 1 on the Massive Text Embedding Benchmark ([MTEB benchmark](https://
|
2011 |
|
2012 |
NV-Embed-v2 presents several new designs, including having the LLM attend to latent vectors for better pooled embedding output, and demonstrating a two-staged instruction tuning method to enhance the accuracy of both retrieval and non-retrieval tasks. Additionally, NV-Embed-v2 incorporates a novel hard-negative mining methods that take into account the positive relevance score for better false negatives removal.
|
2013 |
|
@@ -2049,7 +2047,7 @@ passages = [
|
|
2049 |
model = AutoModel.from_pretrained('nvidia/NV-Embed-v2', trust_remote_code=True)
|
2050 |
|
2051 |
# get the embeddings
|
2052 |
-
max_length =
|
2053 |
query_embeddings = model.encode(queries, instruction=query_prefix, max_length=max_length)
|
2054 |
passage_embeddings = model.encode(passages, instruction=passage_prefix, max_length=max_length)
|
2055 |
|
@@ -2064,7 +2062,7 @@ passage_embeddings = F.normalize(passage_embeddings, p=2, dim=1)
|
|
2064 |
|
2065 |
scores = (query_embeddings @ passage_embeddings.T) * 100
|
2066 |
print(scores.tolist())
|
2067 |
-
# [[87.
|
2068 |
```
|
2069 |
|
2070 |
|
@@ -2091,7 +2089,7 @@ passages = [
|
|
2091 |
|
2092 |
# load model with tokenizer
|
2093 |
model = SentenceTransformer('nvidia/NV-Embed-v2', trust_remote_code=True)
|
2094 |
-
model.max_seq_length =
|
2095 |
model.tokenizer.padding_side="right"
|
2096 |
|
2097 |
def add_eos(input_examples):
|
@@ -2114,7 +2112,7 @@ For commercial purpose, we recommend you to use the models of [NeMo Retriever Mi
|
|
2114 |
|
2115 |
|
2116 |
## Correspondence to
|
2117 |
-
Chankyu Lee ([email protected]),
|
2118 |
|
2119 |
|
2120 |
## Citation
|
|
|
1 |
---
|
2 |
tags:
|
3 |
- mteb
|
|
|
4 |
model-index:
|
5 |
- name: NV-Embed-v2
|
6 |
results:
|
|
|
2003 |
language:
|
2004 |
- en
|
2005 |
license: cc-by-nc-4.0
|
|
|
2006 |
---
|
2007 |
## Introduction
|
2008 |
+
We present NV-Embed-v2, a generalist embedding model that ranks No. 1 on the Massive Text Embedding Benchmark ([MTEB benchmark](https://arxiv.org/abs/2210.07316))(as of Aug 30, 2024), with 56 tasks, encompassing retrieval, reranking, classification, clustering, and semantic textual similarity tasks.
|
2009 |
|
2010 |
NV-Embed-v2 presents several new designs, including having the LLM attend to latent vectors for better pooled embedding output, and demonstrating a two-staged instruction tuning method to enhance the accuracy of both retrieval and non-retrieval tasks. Additionally, NV-Embed-v2 incorporates a novel hard-negative mining methods that take into account the positive relevance score for better false negatives removal.
|
2011 |
|
|
|
2047 |
model = AutoModel.from_pretrained('nvidia/NV-Embed-v2', trust_remote_code=True)
|
2048 |
|
2049 |
# get the embeddings
|
2050 |
+
max_length = 4096
|
2051 |
query_embeddings = model.encode(queries, instruction=query_prefix, max_length=max_length)
|
2052 |
passage_embeddings = model.encode(passages, instruction=passage_prefix, max_length=max_length)
|
2053 |
|
|
|
2062 |
|
2063 |
scores = (query_embeddings @ passage_embeddings.T) * 100
|
2064 |
print(scores.tolist())
|
2065 |
+
# [[87.42692565917969, 0.462837278842926], [0.9652643203735352, 86.0372314453125]]
|
2066 |
```
|
2067 |
|
2068 |
|
|
|
2089 |
|
2090 |
# load model with tokenizer
|
2091 |
model = SentenceTransformer('nvidia/NV-Embed-v2', trust_remote_code=True)
|
2092 |
+
model.max_seq_length = 4096
|
2093 |
model.tokenizer.padding_side="right"
|
2094 |
|
2095 |
def add_eos(input_examples):
|
|
|
2112 |
|
2113 |
|
2114 |
## Correspondence to
|
2115 |
+
Chankyu Lee ([email protected]), Wei Ping ([email protected])
|
2116 |
|
2117 |
|
2118 |
## Citation
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "nvidia/NV-Embed-
|
3 |
"add_eos": true,
|
4 |
"add_pad_token": true,
|
5 |
"architectures": [
|
@@ -18,7 +18,7 @@
|
|
18 |
"model_type": "nvembed",
|
19 |
"padding_side": "right",
|
20 |
"text_config": {
|
21 |
-
"_name_or_path": "nvidia/NV-Embed-
|
22 |
"add_cross_attention": false,
|
23 |
"architectures": [
|
24 |
"MistralModel"
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "nvidia/NV-Embed-v1",
|
3 |
"add_eos": true,
|
4 |
"add_pad_token": true,
|
5 |
"architectures": [
|
|
|
18 |
"model_type": "nvembed",
|
19 |
"padding_side": "right",
|
20 |
"text_config": {
|
21 |
+
"_name_or_path": "nvidia/NV-Embed-v1",
|
22 |
"add_cross_attention": false,
|
23 |
"architectures": [
|
24 |
"MistralModel"
|
configuration_nvembed.py
CHANGED
@@ -76,8 +76,6 @@ class LatentAttentionConfig(PretrainedConfig):
|
|
76 |
self.latent_dim = latent_dim
|
77 |
self.cross_dim_head = cross_dim_head
|
78 |
|
79 |
-
super().__init__(**kwargs)
|
80 |
-
|
81 |
|
82 |
class BidirectionalMistralConfig(MistralConfig):
|
83 |
model_type = BIDIR_MISTRAL_TYPE
|
|
|
76 |
self.latent_dim = latent_dim
|
77 |
self.cross_dim_head = cross_dim_head
|
78 |
|
|
|
|
|
79 |
|
80 |
class BidirectionalMistralConfig(MistralConfig):
|
81 |
model_type = BIDIR_MISTRAL_TYPE
|