Instructions to use heegyu/esconv-xlm-roberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use heegyu/esconv-xlm-roberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="heegyu/esconv-xlm-roberta-base")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("heegyu/esconv-xlm-roberta-base") model = AutoModelForSequenceClassification.from_pretrained("heegyu/esconv-xlm-roberta-base") - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Load model
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("heegyu/esconv-xlm-roberta-base")
model = AutoModelForSequenceClassification.from_pretrained("heegyu/esconv-xlm-roberta-base")
Next strategy prediction
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])
Next strategy prediction (top 3)
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])
- Downloads last month
- 338