File size: 1,531 Bytes
8d9a9e2 |
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 |
---
language: ja
license: cc-by-4.0
library_name: sentence-transformers
tags:
- xlm-roberta
- nli
datasets:
- jnli
- jsick
---
# Japanese Natural Language Inference Model
This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class, [gradient accumulation PR](https://github.com/UKPLab/sentence-transformers/pull/1092), and the code from [CyberAgentAILab/japanese-nli-model](https://github.com/CyberAgentAILab/japanese-nli-model).
## Training Data
The model was trained on the [JGLUE-JNLI](https://github.com/yahoojapan/JGLUE) and [JSICK](https://github.com/verypluming/JSICK) datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral.
## Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained('cyberagent/xlm-roberta-large-jnli-jsick')
model = AutoModelForSequenceClassification.from_pretrained('cyberagent/xlm-roberta-large-jnli-jsick')
features = tokenizer(["εδΎγθ΅°γ£γ¦γγη«γθ¦γ¦γγ", "η«γθ΅°γ£γ¦γγ"], ["η«γθ΅°γ£γ¦γγ", "εδΎγθ΅°γ£γ¦γγ"], 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)
```
|