Update README.md
Browse files
README.md
CHANGED
|
@@ -1,9 +1,95 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
tags: [t5, reframing]
|
| 5 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
|
| 8 |
-
# CI_MA_Reframe
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
|
|
|
| 4 |
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- t5
|
| 7 |
+
- text2text-generation
|
| 8 |
+
- microaggression
|
| 9 |
+
- reframing
|
| 10 |
+
- paraphrase
|
| 11 |
+
pipeline_tag: text2text-generation
|
| 12 |
+
widget:
|
| 13 |
+
- text: "rephrase: You speak good English for someone from there."
|
| 14 |
+
- text: "rephrase: Where are you really from?"
|
| 15 |
+
- text: "rephrase: You're so articulate for your background."
|
| 16 |
+
datasets:
|
| 17 |
+
- custom
|
| 18 |
+
metrics:
|
| 19 |
+
- bleu
|
| 20 |
+
- rouge
|
| 21 |
+
base_model: t5-base
|
| 22 |
+
model-index:
|
| 23 |
+
- name: CI_MA_Reframe
|
| 24 |
+
results:
|
| 25 |
+
- task:
|
| 26 |
+
type: text2text-generation
|
| 27 |
+
name: Microaggression Reframing
|
| 28 |
+
metrics:
|
| 29 |
+
- type: bleu
|
| 30 |
+
value: 0.75
|
| 31 |
+
name: BLEU
|
| 32 |
---
|
| 33 |
|
| 34 |
+
# CI_MA_Reframe - Microaggression Reframing Model
|
| 35 |
+
|
| 36 |
+
This model reframes potentially problematic text into more inclusive language using a fine-tuned T5 architecture.
|
| 37 |
+
|
| 38 |
+
## Model Description
|
| 39 |
+
|
| 40 |
+
- **Model type:** T5 for text-to-text generation
|
| 41 |
+
- **Task:** Text reframing/paraphrasing
|
| 42 |
+
- **Base model:** t5-base
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
**Important:** Always prefix your input with `"rephrase: "` for proper generation.
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 50 |
+
|
| 51 |
+
tokenizer = T5Tokenizer.from_pretrained("jokugeorgin/CI_MA_Reframe")
|
| 52 |
+
model = T5ForConditionalGeneration.from_pretrained("jokugeorgin/CI_MA_Reframe")
|
| 53 |
+
|
| 54 |
+
text = "rephrase: You speak good English for someone from there."
|
| 55 |
+
inputs = tokenizer(text, return_tensors="pt", max_length=256, truncation=True)
|
| 56 |
+
|
| 57 |
+
outputs = model.generate(
|
| 58 |
+
**inputs,
|
| 59 |
+
max_length=256,
|
| 60 |
+
num_beams=5,
|
| 61 |
+
num_return_sequences=3,
|
| 62 |
+
temperature=0.8,
|
| 63 |
+
do_sample=True,
|
| 64 |
+
no_repeat_ngram_size=2
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
for output in outputs:
|
| 68 |
+
print(tokenizer.decode(output, skip_special_tokens=True))
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## API Usage
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
curl https://api-inference.huggingface.co/models/jokugeorgin/CI_MA_Reframe \
|
| 75 |
+
-H "Authorization: Bearer YOUR_HF_TOKEN" \
|
| 76 |
+
-H "Content-Type: application/json" \
|
| 77 |
+
-d '{
|
| 78 |
+
"inputs": "rephrase: You speak good English for someone from there.",
|
| 79 |
+
"parameters": {
|
| 80 |
+
"max_new_tokens": 96,
|
| 81 |
+
"num_return_sequences": 3,
|
| 82 |
+
"temperature": 0.8
|
| 83 |
+
}
|
| 84 |
+
}'
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Training Data
|
| 88 |
+
|
| 89 |
+
Custom dataset of microaggression examples and their reframed alternatives.
|
| 90 |
+
|
| 91 |
+
## Limitations
|
| 92 |
+
|
| 93 |
+
- Requires "rephrase: " prefix for optimal results
|
| 94 |
+
- Works best with English text
|
| 95 |
+
- May occasionally produce generic reframings
|