Add model card
Browse files
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
base_model: FacebookAI/roberta-large
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
tags:
|
| 7 |
+
- emotion
|
| 8 |
+
- valence
|
| 9 |
+
- arousal
|
| 10 |
+
- memory
|
| 11 |
+
- LUFY
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# LUFY — RoBERTa-large valence/arousal predictor
|
| 15 |
+
|
| 16 |
+
Fine-tuned `roberta-large` that predicts **valence** and **arousal** of a text (2-output regression), trained on [EmoBank](https://github.com/JULIELab/EmoBank).
|
| 17 |
+
|
| 18 |
+
This model is part of **[LUFY](https://github.com/ryuichi-sumida/LUFY)** — a RAG chatbot that selectively forgets unimportant conversations — where it estimates the emotional intensity of conversation turns as one signal of memory importance. See the paper: [Enhancing Long-term RAG Chatbots with Psychological Models of Memory Importance and Forgetting](https://arxiv.org/abs/2409.12524).
|
| 19 |
+
|
| 20 |
+
The companion conversation dataset is at [RuiSumida/LUFY (dataset)](https://huggingface.co/datasets/RuiSumida/LUFY).
|
| 21 |
+
|
| 22 |
+
## Files
|
| 23 |
+
|
| 24 |
+
- `best_roberta_large.pth` — PyTorch `state_dict` for `RobertaForSequenceClassification` (`num_labels=2`, outputs `[valence, arousal]`)
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import torch
|
| 30 |
+
from huggingface_hub import hf_hub_download
|
| 31 |
+
from transformers import RobertaTokenizer, RobertaForSequenceClassification
|
| 32 |
+
|
| 33 |
+
model = RobertaForSequenceClassification.from_pretrained("roberta-large", num_labels=2)
|
| 34 |
+
model_path = hf_hub_download(repo_id="RuiSumida/LUFY", filename="best_roberta_large.pth")
|
| 35 |
+
model.load_state_dict(torch.load(model_path, map_location="cpu"))
|
| 36 |
+
model.eval()
|
| 37 |
+
|
| 38 |
+
tokenizer = RobertaTokenizer.from_pretrained("roberta-large")
|
| 39 |
+
enc = tokenizer("I can't believe we won the finals!", max_length=128,
|
| 40 |
+
padding="max_length", truncation=True, return_tensors="pt")
|
| 41 |
+
with torch.no_grad():
|
| 42 |
+
valence, arousal = model(**enc).logits.squeeze()
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Citation
|
| 46 |
+
|
| 47 |
+
If you use this model, please cite the LUFY paper: https://arxiv.org/abs/2409.12524
|