Text Classification
sentence-transformers
Safetensors
Transformers
English
nvembed
feature-extraction
mteb
text
text-embeddings-inference
sparse-encoder
sparse
csr
custom_code
Eval Results (legacy)
Instructions to use Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77 with sentence-transformers:
from sentence_transformers import SparseEncoder model = SparseEncoder("Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77", trust_remote_code=True) queries = ["Which planet is known as the Red Planet?"] documents = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", ] query_embeddings = model.encode_query(queries) document_embeddings = model.encode_document(documents) similarities = model.similarity(query_embeddings, document_embeddings) print(similarities) - Transformers
How to use Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77/resolve/main/README.md
- Command line
-
hf download hf://Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77/README.md
-
curl -L -o README.md https://huggingface.co/Y-Research-Group/CSR-NV_Embed_v2-Classification-Banking77/resolve/main/README.md
2.34 kB
metadata
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.
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:
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
@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}
}