uf-aice-lab
commited on
Commit
•
f49d103
1
Parent(s):
95739ab
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Math-RoBerta for NLP tasks in math learning environments
|
2 |
+
|
3 |
+
This model is fine-tuned with GPT-xl with over 3,000,000 posts and replies from students and instructors in Algebra Nation (https://www.mathnation.com/). It was trained to allow researchers to control generated responses' safety using tags `[SAFE]` and `[UNSAFE]`
|
4 |
+
|
5 |
+
### Here is how to use it with texts in HuggingFace
|
6 |
+
```python
|
7 |
+
# A list of special tokens the model was trained with
|
8 |
+
special_tokens_dict = {
|
9 |
+
'additional_special_tokens': [
|
10 |
+
'[SAFE]','[UNSAFE]', '[OK]', '[SELF_M]','[SELF_F]', '[SELF_N]',
|
11 |
+
'[PARTNER_M]', '[PARTNER_F]', '[PARTNER_N]',
|
12 |
+
'[ABOUT_M]', '[ABOUT_F]', '[ABOUT_N]', '<speaker1>', '<speaker2>'
|
13 |
+
],
|
14 |
+
'bos_token': '<bos>',
|
15 |
+
'eos_token': '<eos>',
|
16 |
+
}
|
17 |
+
|
18 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
19 |
+
|
20 |
+
math_bot_tokenizer = AutoTokenizer.from_pretrained('uf-aice-lab/SafeMathBot')
|
21 |
+
safe_math_bot = AutoModelForCausalLM.from_pretrained('uf-aice-lab/SafeMathBot')
|
22 |
+
text = "Replace me by any text you'd like."
|
23 |
+
encoded_input = math_bot_tokenizer(text, return_tensors='pt')
|
24 |
+
output = safe_math_bot(**encoded_input)
|
25 |
+
```
|