Downloads · 30 days
7
2% of all-time downloads
heegyu/esconv-xlm-roberta-base
esconv-xlm-roberta-base is a text classification model from heegyu. Use it when you need a label for a piece of text. It is set up for transformers.
Downloads · 30 days
7
2% of all-time downloads
All-time downloads
431
Public
Parameters
278M
5.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("heegyu/esconv-xlm-roberta-base")
model = AutoModelForSequenceClassification.from_pretrained("heegyu/esconv-xlm-roberta-base")
example = """usr: Hi
sys[Question]: Hello, how are you today?
usr: I was scolded by my parents yesterday"""
inputs = tokenizer(example, return_tensors="pt")
logits = model(**inputs).logits.softmax(-1)
print(logits)
label = logits.argmax(-1).item()
ESCONV_STRATEGY = [
"Question",
"Restatement or Paraphrasing",
"Reflection of feelings",
"Self-disclosure",
"Affirmation and Reassurance",
"Providing Suggestions",
"Information",
"Others"
]
id2label = {i:k for i, k in enumerate(ESCONV_STRATEGY)}
print(id2label[label])
example = """usr: Hi
sys[Question]: Hello, how are you today?
usr: I was scolded by my parents yesterday"""
inputs = tokenizer(example, return_tensors="pt")
logits = model(**inputs).logits.softmax(-1)
print(logits)
labels = logits.topk(3)[1][0].tolist()
ESCONV_STRATEGY = [
"Question",
"Restatement or Paraphrasing",
"Reflection of feelings",
"Self-disclosure",
"Affirmation and Reassurance",
"Providing Suggestions",
"Information",
"Others"
]
id2label = {i:k for i, k in enumerate(ESCONV_STRATEGY)}
for id in labels:
print(id2label[id])