Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- obx0x3/empathy-dementia
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
- fr
|
| 8 |
+
metrics:
|
| 9 |
+
- bleu
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## Empathy Dementia
|
| 13 |
+
A fine‑tuned multilingual T5‑Base model for empathetic responses designed for individuals with dementia.
|
| 14 |
+
|
| 15 |
+
## Training Corpus
|
| 16 |
+
- **Data splits:**
|
| 17 |
+
- Training: 120 examples
|
| 18 |
+
- Validation: 30 examples
|
| 19 |
+
- Test: 30 examples
|
| 20 |
+
- **Languages:** English (`"en"`) and French (`"fr"`)
|
| 21 |
+
- **Data structure:** Each sample includes:
|
| 22 |
+
```json
|
| 23 |
+
{
|
| 24 |
+
"input": "Where are my glasses?",
|
| 25 |
+
"target": "Let’s look together. Maybe near your chair.",
|
| 26 |
+
"lang": "en"
|
| 27 |
+
}
|
| 28 |
+
## Training Results (Cross-Entropy Loss)
|
| 29 |
+
|
| 30 |
+
| Epoch | Training Loss | Validation Loss |
|
| 31 |
+
|-------|---------------|-----------------|
|
| 32 |
+
| 1 | 0.191100 | 0.101121 |
|
| 33 |
+
| 2 | 0.119100 | 0.061524 |
|
| 34 |
+
| 3 | 0.103100 | 0.042741 |
|
| 35 |
+
| 4 | 0.079900 | 0.038426 |
|
| 36 |
+
|
| 37 |
+
# Usage:
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 41 |
+
|
| 42 |
+
model = T5ForConditionalGeneration.from_pretrained("obx0x3/empathy-dementia")
|
| 43 |
+
tokenizer = T5Tokenizer.from_pretrained("obx0x3/empathy-dementia")
|
| 44 |
+
|
| 45 |
+
def empathetic_response(prompt, lang="en"):
|
| 46 |
+
prefix = "emotion: " if lang == "en" else "émotion: "
|
| 47 |
+
input_ids = tokenizer(prefix + prompt, return_tensors="pt").input_ids
|
| 48 |
+
output_ids = model.generate(input_ids, max_length=50)
|
| 49 |
+
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
# Example
|
| 53 |
+
```
|
| 54 |
+
print(empathetic_response("I feel so lonely.", lang="en"))
|
| 55 |
+
print(empathetic_response("Je me sens seul.", lang="fr"))
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Intended Use & Limitations
|
| 59 |
+
MSc Dissertion Proof of concept and work for primary use case: Aid communication with individuals experiencing memory loss, confusion, or distress
|
| 60 |
+
|
| 61 |
+
NOT for clinical decisions — designed as a supportive tool
|