A fine‑tuned multilingual T5‑Base model for empathetic responses designed for individuals with dementia.
from transformers import T5Tokenizer, T5ForConditionalGeneration
model = T5ForConditionalGeneration.from_pretrained("obx0x3/empathy-dementia")
tokenizer = T5Tokenizer.from_pretrained("obx0x3/empathy-dementia")
def empathetic_response(prompt, lang="en"):
prefix = "emotion: " if lang == "en" else "émotion: "
input_ids = tokenizer(prefix + prompt, return_tensors="pt").input_ids
output_ids = model.generate(input_ids, max_length=50)
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(empathetic_response("I feel so lonely.", lang="en"))
print(empathetic_response("Je me sens seul.", lang="fr"))
MSc Dissertion Proof of concept and work for primary use case: Aid communication with individuals experiencing memory loss, confusion, or distress