File size: 2,342 Bytes
12c07c1
732b52b
 
7e8a1f7
732b52b
 
7e8a1f7
732b52b
12c07c1
 
732b52b
13325f2
77f4476
10a8215
 
 
7e8a1f7
12c07c1
7e8a1f7
12c07c1
7e8a1f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12c07c1
 
 
7e8a1f7
7469b9e
12c07c1
 
7469b9e
447cad6
12c07c1
7469b9e
12c07c1
7469b9e
9d8695e
12c07c1
9d8695e
7e8a1f7
 
 
9d8695e
 
 
7e8a1f7
9d8695e
7e8a1f7
9d8695e
7e8a1f7
 
 
 
 
 
 
12c07c1
 
 
 
b2f5a2a
 
 
 
12c07c1
b2f5a2a
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
license: mit
datasets:
- mteb/banking77
language:
- en
pipeline_tag: text-classification
library_name: sentence-transformers
tags:
- mteb
- text
- transformers
- text-embeddings-inference
- sparse-encoder
- sparse
- csr

model-index:
- name: CSR
  results:
  - dataset:
      name: MTEB Banking77Classification
      type: mteb/banking77
      config: default
      revision: 0fd18e25b25c072e09e0d92ab615fda904d66300
      split: test
    metrics:
    - type: accuracy
      value: 0.899545
    - type: f1
      value: 0.899018
    - type: f1_weighted
      value: 0.899018
    - type: main_score
      value: 0.899545
    task:
      type: Classification
base_model:
  - nvidia/NV-Embed-v2
---



For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our [Github](https://github.com/neilwen987/CSR_Adaptive_Rep).


## Usage
📌 **Tip**: For NV-Embed-V2, using Transformers versions **later** than 4.47.0 may lead to performance degradation, as ``model_type=bidir_mistral`` in ``config.json``  is no longer supported.

We recommend using ``Transformers 4.47.0.``

### Sentence Transformers Usage
You can evaluate this model loaded by Sentence Transformers with the following code snippet:
```python
import mteb
from sentence_transformers import SparseEncoder
model = SparseEncoder(
    "Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77",
    trust_remote_code=True
)
model.prompts = {
    "Banking77Classification": "Instruct: Given a online banking query, find the corresponding intents\nQuery:"
}
task = mteb.get_tasks(tasks=["Banking77Classification"])
evaluation = mteb.MTEB(tasks=task)
evaluation.run(
    model,
    eval_splits=["test"],
    output_folder="./results/Banking77Classification",
    show_progress_bar=True
    encode_kwargs={"convert_to_sparse_tensor": False, "batch_size": 8}
)  # MTEB don't support sparse tensors yet, so we need to convert to dense tensors
```

## Citation
```bibtex
@inproceedings{wenbeyond,
  title={Beyond Matryoshka: Revisiting Sparse Coding for Adaptive Representation},
  author={Wen, Tiansheng and Wang, Yifei and Zeng, Zequn and Peng, Zhong and Su, Yudi and Liu, Xinyang and Chen, Bo and Liu, Hongwei and Jegelka, Stefanie and You, Chenyu},
  booktitle={Forty-second International Conference on Machine Learning}
}
```