Downloads · 30 days
13
5% of all-time downloads
RyanDDD/bert-motivational-interviewing
bert-motivational-interviewing is a text classification model from RyanDDD. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
This model is a fine-tuned BERT-base-uncased model for classifying client utterances in Motivational Interviewing (MI) conversations.
Downloads · 30 days
13
5% of all-time downloads
All-time downloads
272
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This model is a fine-tuned BERT-base-uncased model for classifying client utterances in Motivational Interviewing (MI) conversations.
Motivational Interviewing is a counseling approach used to help individuals overcome ambivalence and make positive behavioral changes. This model identifies different types of client talk that indicate their readiness for change.
The model was trained on the AnnoMI dataset (Annotated Motivational Interviewing), which contains expert-annotated counseling dialogues.
The model classifies client talk into three categories:
Change Talk: Client statements expressing desire, ability, reasons, or need for change
Neutral: General responses without clear indication of change or sustain
Sustain Talk: Client statements expressing reasons for maintaining current behavior
Predicted
change neutral sustain
Actual change 75 78 23
neutral 43 396 27
sustain 11 34 36
Note: The model performs best on the "neutral" class (most frequent), and has room for improvement on "change" and "sustain" classes.
from transformers import BertTokenizer, BertForSequenceClassification
import torch
# Load model and tokenizer
model_name = "RyanDDD/bert-motivational-interviewing"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
# Predict
text = "I really want to quit smoking. It's been affecting my health."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
pred = torch.argmax(probs, dim=1)
label_map = model.config.id2label
print(f"Talk type: {label_map[pred.item()]}")
print(f"Confidence: {probs[0][pred].item():.2%}")
texts = [
"I want to stop drinking.",
"I don't think I have a problem.",
"I like drinking with my friends."
]
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
preds = torch.argmax(probs, dim=1)
for text, pred, prob in zip(texts, preds, probs):
label = model.config.id2label[pred.item()]
confidence = prob[pred].item()
print(f"Text: {text}")
print(f"Type: {label} ({confidence:.1%})")
print()
bert-base-uncasedTrained on a single GPU (NVIDIA GPU recommended).
If you use this model, please cite:
@misc{bert-mi-classifier-2024,
author = {Ryan},
title = {BERT for Motivational Interviewing Client Talk Classification},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/RyanDDD/bert-motivational-interviewing}}
}
For questions or feedback, please open an issue in the model repository.