初始化项目,由ModelHub XC社区提供模型

Model: cross-encoder/nli-deberta-base
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-13 16:22:43 +08:00
commit 259530d8ca
21 changed files with 50174 additions and 0 deletions

9
.gitattributes vendored Normal file
View File

@@ -0,0 +1,9 @@
*.bin.* filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
model.safetensors filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,13 @@
epoch,steps,Accuracy
0,10000,0.8647301215851859
0,20000,0.8722083736073664
0,30000,0.8845195095894592
0,40000,0.8869105153380475
0,50000,0.8886910515338048
0,-1,0.8922521239253193
1,10000,0.8953553441522104
1,20000,0.8956605789286259
1,30000,0.898204202065422
1,40000,0.9005443353512743
1,50000,0.9018670193824083
1,-1,0.9018670193824083
1 epoch steps Accuracy
2 0 10000 0.8647301215851859
3 0 20000 0.8722083736073664
4 0 30000 0.8845195095894592
5 0 40000 0.8869105153380475
6 0 50000 0.8886910515338048
7 0 -1 0.8922521239253193
8 1 10000 0.8953553441522104
9 1 20000 0.8956605789286259
10 1 30000 0.898204202065422
11 1 40000 0.9005443353512743
12 1 50000 0.9018670193824083
13 1 -1 0.9018670193824083

69
README.md Normal file
View File

@@ -0,0 +1,69 @@
---
language: en
pipeline_tag: zero-shot-classification
tags:
- transformers
datasets:
- nyu-mll/multi_nli
- stanfordnlp/snli
metrics:
- accuracy
license: apache-2.0
base_model:
- microsoft/deberta-base
library_name: sentence-transformers
---
# Cross-Encoder for Natural Language Inference
This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class.
## Training Data
The model was trained on the [SNLI](https://nlp.stanford.edu/projects/snli/) and [MultiNLI](https://cims.nyu.edu/~sbowman/multinli/) datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral.
## Performance
For evaluation results, see [SBERT.net - Pretrained Cross-Encoder](https://www.sbert.net/docs/pretrained_cross-encoders.html#nli).
## Usage
Pre-trained models can be used like this:
```python
from sentence_transformers import CrossEncoder
model = CrossEncoder('cross-encoder/nli-deberta-base')
scores = model.predict([('A man is eating pizza', 'A man eats something'), ('A black race car starts up in front of a crowd of people.', 'A man is driving down a lonely road.')])
#Convert scores to labels
label_mapping = ['contradiction', 'entailment', 'neutral']
labels = [label_mapping[score_max] for score_max in scores.argmax(axis=1)]
```
## Usage with Transformers AutoModel
You can use the model also directly with Transformers library (without SentenceTransformers library):
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model = AutoModelForSequenceClassification.from_pretrained('cross-encoder/nli-deberta-base')
tokenizer = AutoTokenizer.from_pretrained('cross-encoder/nli-deberta-base')
features = tokenizer(['A man is eating pizza', 'A black race car starts up in front of a crowd of people.'], ['A man eats something', 'A man is driving down a lonely road.'], padding=True, truncation=True, return_tensors="pt")
model.eval()
with torch.no_grad():
scores = model(**features).logits
label_mapping = ['contradiction', 'entailment', 'neutral']
labels = [label_mapping[score_max] for score_max in scores.argmax(dim=1)]
print(labels)
```
## Zero-Shot Classification
This model can also be used for zero-shot-classification:
```python
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-deberta-base')
sent = "Apple just announced the newest iPhone X"
candidate_labels = ["technology", "sports", "politics"]
res = classifier(sent, candidate_labels)
print(res)
```

3
bpe_encoder.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:caff5a98d15fd439255194f3fcfd41a7b276b500cdf69caba890ae242c498797
size 3918127

42
config.json Normal file
View File

@@ -0,0 +1,42 @@
{
"_name_or_path": "microsoft/deberta-base",
"architectures": [
"DebertaForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"id2label": {
"0": "contradiction",
"1": "entailment",
"2": "neutral"
},
"initializer_range": 0.02,
"intermediate_size": 3072,
"label2id": {
"contradiction": 0,
"entailment": 1,
"neutral": 2
},
"layer_norm_eps": 1e-07,
"max_position_embeddings": 512,
"max_relative_positions": -1,
"model_type": "deberta",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"pooler_dropout": 0,
"pooler_hidden_act": "gelu",
"pooler_hidden_size": 768,
"pos_att_type": [
"c2p",
"p2c"
],
"position_biased_input": false,
"relative_attention": true,
"tokenizer_class": "DebertaTokenizerFast",
"transformers_version": "4.7.0",
"type_vocab_size": 0,
"vocab_size": 50265
}

50001
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32571f8a86511ef4a29b668928a81c3c2222dc68e757c0a26387a37b1fac707a
size 556806836

3
onnx/model.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e21552123e1329ef20edc8b64d02c0dca67396496cbcc86391dea9ae5d13c9b1
size 557350444

3
onnx/model_O1.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:920a25b437b8b4ea7ae792d9f5aca784ce8a9d51ab0e5c550390f7f2e63b6c76
size 557151477

3
onnx/model_O2.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db9d63bfa585fa6256d2636231b6445f3754353fb05ff611d1fde6ceb400e32f
size 557085151

3
onnx/model_O3.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3d4cb9e96ae0237d3ebc5d1feb2b58b38974594ab333a71a76183c0b39af07a
size 557084990

3
onnx/model_O4.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc1056b0753657c24815c1304853c37964863f8e99b510d4ee474971233a8992
size 278712452

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3feb43edd1e9170e5e783f0b14c4eedb2137a4f5bdc4017435567f20ff13f790
size 143379181

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3feb43edd1e9170e5e783f0b14c4eedb2137a4f5bdc4017435567f20ff13f790
size 143379181

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3feb43edd1e9170e5e783f0b14c4eedb2137a4f5bdc4017435567f20ff13f790
size 143379181

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63408e82fdb514f94e6cb2d585abb94268fdedeb1bcad5712c915d0e4ac4b385
size 143379180

3
pytorch_model.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9eeedc383e1233cdff985aab798fd099c8444a2208620a95101395938cd5c307
size 556867008

1
special_tokens_map.json Normal file
View File

@@ -0,0 +1 @@
{"bos_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "[UNK]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "[PAD]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}

1
tokenizer.json Normal file

File diff suppressed because one or more lines are too long

1
tokenizer_config.json Normal file
View File

@@ -0,0 +1 @@
{"unk_token": {"content": "[UNK]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": false, "errors": "replace", "sep_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "cls_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "pad_token": {"content": "[PAD]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "do_lower_case": false, "vocab_type": "gpt2", "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "nli-deberta-base/"}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long