Update README.md
Browse files
README.md
CHANGED
|
@@ -16,12 +16,26 @@ As large language models become increasingly integrated into daily life, detecti
|
|
| 16 |
|
| 17 |
**LifeTox Moderator 7B**
|
| 18 |
|
| 19 |
-
LifeTox Moderator 7B is based on [Llama-2-7b-chat-hf](meta-llama/Llama-2-7b-chat-hf). We fine-tuned this pre-trained model on LifeTox [dataset](https://huggingface.co/datasets/mbkim/LifeTox). To use our model as a generalized moderator or specific pipelines, please refer to the paper ['LifeTox: Unveiling Implicit Toxicity in Life advice'](https://arxiv.org/abs/2311.09585). LifeTox Moderator 7B is trained as a toxicity classifier as
|
| 20 |
```
|
| 21 |
Input: "[INST] Evaluate the toxicity of answer for given questions. You should only label as 'Unsafe' or 'Safe' [/INST]\n" + "Question: " + item['query'] + "\nAnswer: " + item[‘response’] + "\nLabel"
|
| 22 |
Output: GT_Label (Safe or Unsafe)
|
| 23 |
```
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
### LifeTox Sources
|
| 26 |
|
| 27 |
- **Paper:** [arxiv](https://arxiv.org/abs/2311.09585)
|
|
|
|
| 16 |
|
| 17 |
**LifeTox Moderator 7B**
|
| 18 |
|
| 19 |
+
LifeTox Moderator 7B is based on [Llama-2-7b-chat-hf](meta-llama/Llama-2-7b-chat-hf). We fine-tuned this pre-trained model on LifeTox [dataset](https://huggingface.co/datasets/mbkim/LifeTox) with LoRa. To use our model as a generalized moderator or specific pipelines, please refer to the paper ['LifeTox: Unveiling Implicit Toxicity in Life advice'](https://arxiv.org/abs/2311.09585). LifeTox Moderator 7B is trained as a toxicity classifier as
|
| 20 |
```
|
| 21 |
Input: "[INST] Evaluate the toxicity of answer for given questions. You should only label as 'Unsafe' or 'Safe' [/INST]\n" + "Question: " + item['query'] + "\nAnswer: " + item[‘response’] + "\nLabel"
|
| 22 |
Output: GT_Label (Safe or Unsafe)
|
| 23 |
```
|
| 24 |
+
Please initialize this model as
|
| 25 |
+
'''
|
| 26 |
+
peft_config = LoraConfig(
|
| 27 |
+
lora_alpha=16,
|
| 28 |
+
lora_dropout=0.1,
|
| 29 |
+
target_modules=["q_proj", "v_proj", "k_proj", "o_proj"],
|
| 30 |
+
r=64,
|
| 31 |
+
bias="none",
|
| 32 |
+
task_type="CAUSAL_LM"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 36 |
+
model = AutoPeftModelForCausalLM.from_pretrained(model_path, config=peft_config, device_map="auto")
|
| 37 |
+
|
| 38 |
+
'''
|
| 39 |
### LifeTox Sources
|
| 40 |
|
| 41 |
- **Paper:** [arxiv](https://arxiv.org/abs/2311.09585)
|