Downloads · 30 days
6
3% of all-time downloads
andrewzolens/speaker-ident-bert-passage-f1-c2-d100-s129
speaker-ident-bert-passage-f1-c2-d100-s129 is a text classification model from andrewzolens. Use it when you need a label for a piece of text. It is set up for transformers.
This model performs Speaker Role Identification in Clinical Conversations between doctors, patients, medical assistants, and others. The model expects text sequences as input. These text sequences are expected to come…
Downloads · 30 days
6
3% of all-time downloads
All-time downloads
185
Public
Parameters
108M
433 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors433 MB · 100%
From the Hugging Face model README
This model performs Speaker Role Identification in Clinical Conversations between doctors, patients, medical assistants, and others. The model expects text sequences as input. These text sequences are expected to come from a speech transcript generated using ASR with speaker diarization. Inputs are formatted as follows:
Speaker 0: Do you have any pain today? (10)
Speaker 1: Yes, my chest has been hurting since yesterday. (11)
where the diarization identifiers have been pre-fixed to each utterance, the number of preceding utterances in the conversation post-fixed, and the target utterance is given as the last utterance.
This model is an instance of the BertModelForSequenceClassification model available on HuggingFace, which has been fine-tuned for speaker role identification.
This model was trained on Fold 1 of our data, with two-utterance context windows, and 100% diarization accuracy, which we simply simulated from ground truth labels. Hence the name of the model:
speaker-ident-bert-passage-f1-c2-d100-s129
This model was extensively evaluated and findings were reported in the paper linked here: https://pmc.ncbi.nlm.nih.gov/articles/PMC12632672/. Paper forthcoming in PSB 2026.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
This model is intended for use by researchers interested in studying clinical communication profiles and their impact on functional outcomes at scale using NLP.
This model will not work well for conversations where the roles of interest differ substantially from those of "patient," "provider", and "medical assistant", meaning that "other" will not be informative enough.
This model may not work well for data from non-clinical settings.
Training data are not made publicly available due to status as Protected Health Information.
Data come from the Establishing Focus Study, and RCT designed to study agenda-setting behavior in clinicians.
Full fine-tuning using HuggingFace and BertForSequenceClassification library support.
See paper and summary above.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
hub_repo_id = "andrewzolens/speaker-ident-bert-passage-f1-c2-d100-s129"
hub_model = AutoModelForSequenceClassification.from_pretrained(hub_repo_id)
hub_tokenizer = AutoTokenizer.from_pretrained(hub_repo_id)
text = "Speaker 1: hi! (0)\nSpeaker 2: What brings you in today? (1)"
tokens = hub_tokenizer(
text,
padding='max_length',
truncation=True,
max_length=hub_tokenizer.model_max_length,
return_tensors="pt",
)
with torch.no_grad():
outputs = hub_model(**tokens)
logits = outputs.logits
prediction = hub_model.config.id2label[torch.argmax(logits, dim=1).item()]