Text Generation
PEFT
English
hate speech
conversational
palomapiot commited on
Commit
5acf45a
1 Parent(s): 5023ee4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -35
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  library_name: peft
3
- base_model: mistralai/Mistral-7B-Instruct-v0.1
4
  license: mit
5
  datasets:
6
  - irlab-udc/metahate
@@ -14,7 +14,7 @@ tags:
14
  # Mistral Fine-Tuned on not Engaging with Hate Speech
15
 
16
  ## Model Description
17
- This model is a fine-tuned version of `mistralai/Mistral-7B-Instruct-v0.1` on a hate speech dataset using the PEFT approach, to prevent the model from exacerbating hate discourse.
18
 
19
  ## Intended Uses & Limitations
20
  This model is intended for research purposes in conversational applications to stop hate speech generation.
@@ -25,17 +25,26 @@ This model is intended for research purposes in conversational applications to s
25
  - **False Positives/Negatives**: It's not perfect and may continue some hate speech conversations.
26
  - **Domain Specificity**: Performance may vary across different domains.
27
 
28
- ### Recommendations
29
-
30
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
31
-
32
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
33
-
34
  ## How to Get Started with the Model
35
 
36
  Use the code below to get started with the model.
37
 
38
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  ## Training Details
41
 
@@ -46,39 +55,33 @@ Use the code below to get started with the model.
46
  [More Information Needed]
47
 
48
  ## Training Procedure
49
- - **Base Model:** mistralai/Mistral-7B-Instruct-v0.1
50
  - **Fine-Tuning:** Using PEFT approach
51
- - **Hardware:** Information about the hardware used
52
-
53
- #### Training Hyperparameters
54
-
55
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
56
-
57
-
58
- ## Environmental Impact
59
-
60
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
61
-
62
- - **Hardware Type:** RTX A6000
63
- - **Hours used:** 9
64
- - **Cloud Provider:** Private Infrastructure
65
- - **Carbon Efficiency (kg/kWh):** 0,432
66
- - **Carbon Emitted (kg eq. CO2):** 1,17
67
 
 
68
 
69
- ## Citation
 
 
 
 
 
70
 
71
- If you use this model, please cite the following reference:
72
 
73
- ```bibtex
74
- @article{
75
- SOON!
76
- }
77
- ```
78
-
79
- ## Training procedure
80
 
81
  The following `bitsandbytes` quantization config was used during training:
 
82
  - quant_method: bitsandbytes
83
  - _load_in_8bit: False
84
  - _load_in_4bit: True
@@ -96,6 +99,31 @@ The following `bitsandbytes` quantization config was used during training:
96
  ### Framework versions
97
 
98
  - PEFT 0.6.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  ## Acknowledgements
101
  The authors thank the funding from the Horizon Europe research and innovation programme under the Marie Skłodowska-Curie Grant Agreement No. 101073351. The authors also thank the financial support supplied by the Consellería de Cultura, Educación, Formación Profesional e Universidades (accreditation 2019-2022 ED431G/01, ED431B 2022/33) and the European Regional Development Fund, which acknowledges the CITIC Research Center in ICT of the University of A Coruña as a Research Center of the Galician University System and the project PID2022-137061OB-C21 (Ministerio de Ciencia e Innovación, Agencia Estatal de Investigación, Proyectos de Generación de Conocimiento; supported by the European Regional Development Fund). The authors also thank the funding of project PLEC2021-007662 (MCIN/AEI/10.13039/501100011033, Ministerio de Ciencia e Innovación, Agencia Estatal de Investigación, Plan de Recuperación, Transformación y Resiliencia, Unión Europea-Next Generation EU).
 
1
  ---
2
  library_name: peft
3
+ base_model: mistralai/Mistral-7B-Instruct-v0.2
4
  license: mit
5
  datasets:
6
  - irlab-udc/metahate
 
14
  # Mistral Fine-Tuned on not Engaging with Hate Speech
15
 
16
  ## Model Description
17
+ This model is a fine-tuned version of `mistralai/Mistral-7B-Instruct-v0.2` on a hate speech dataset using the PEFT approach, to prevent the model from exacerbating hate discourse.
18
 
19
  ## Intended Uses & Limitations
20
  This model is intended for research purposes in conversational applications to stop hate speech generation.
 
25
  - **False Positives/Negatives**: It's not perfect and may continue some hate speech conversations.
26
  - **Domain Specificity**: Performance may vary across different domains.
27
 
 
 
 
 
 
 
28
  ## How to Get Started with the Model
29
 
30
  Use the code below to get started with the model.
31
 
32
+ ```python
33
+ from peft import PeftModel, PeftConfig
34
+ from transformers import AutoModelForCausalLM, AutoTokenizer, Conversation, pipeline
35
+
36
+ # Load the model
37
+ config = PeftConfig.from_pretrained("irlab-udc/Mistral-7b-Stop-Hate")
38
+ base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
39
+ model = PeftModel.from_pretrained(base_model, "irlab-udc/Mistral-7b-Stop-Hate")
40
+ tokenizer = AutoTokenizer.from_pretrained("irlab-udc/Mistral-7b-Stop-Hate")
41
+ chatbot = pipeline(task="conversational", model=model, tokenizer=tokenizer)
42
+
43
+ # Test the model
44
+ conversation = Conversation("Your input text here")
45
+ conversation = chatbot(conversation)
46
+ result = conversation.messages[-1]["content"]
47
+ ```
48
 
49
  ## Training Details
50
 
 
55
  [More Information Needed]
56
 
57
  ## Training Procedure
58
+ - **Base Model:** mistralai/Mistral-7B-Instruct-v0.2
59
  - **Fine-Tuning:** Using PEFT approach
60
+ - **Hardware:** NVIDIA RTX A6000
61
+ -
62
+ #### Configurations and Hyperparameters
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ The following LoraConfig config was used during training:
65
 
66
+ - r: 32
67
+ - lora_alpha: 64
68
+ - target_modules: ["q_proj", "v_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj", "lm_head"]
69
+ - lora_dropout: 0.05
70
+ - bias: "lora_only"
71
+ - task_type: "CAUSAL_LM"
72
 
73
+ The following TrainingArguments config was used during training:
74
 
75
+ - per_device_train_batch_size: 16
76
+ - gradient_accumulation_steps: 1
77
+ - warmup_steps: 5
78
+ - max_steps: 1000
79
+ - learning_rate: 2.5e-5
80
+ - fp16=True
81
+ - optim= paged_adamw_8bit
82
 
83
  The following `bitsandbytes` quantization config was used during training:
84
+
85
  - quant_method: bitsandbytes
86
  - _load_in_8bit: False
87
  - _load_in_4bit: True
 
99
  ### Framework versions
100
 
101
  - PEFT 0.6.2
102
+ - PyTorch 2.1.0
103
+ - 🤗 Transformers 4.35.0
104
+ - 🤗 Datasets 2.14.6
105
+
106
+
107
+ ## Environmental Impact
108
+
109
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
110
+
111
+ - **Hardware Type:** NVIDIA RTX A6000
112
+ - **Hours used:** 9
113
+ - **Cloud Provider:** Private Infrastructure
114
+ - **Carbon Efficiency (kg/kWh):** 0,432
115
+ - **Carbon Emitted (kg eq. CO2):** 1,17
116
+
117
+
118
+ ## Citation
119
+
120
+ If you use this model, please cite the following reference:
121
+
122
+ ```bibtex
123
+ @article{
124
+ SOON!
125
+ }
126
+ ```
127
 
128
  ## Acknowledgements
129
  The authors thank the funding from the Horizon Europe research and innovation programme under the Marie Skłodowska-Curie Grant Agreement No. 101073351. The authors also thank the financial support supplied by the Consellería de Cultura, Educación, Formación Profesional e Universidades (accreditation 2019-2022 ED431G/01, ED431B 2022/33) and the European Regional Development Fund, which acknowledges the CITIC Research Center in ICT of the University of A Coruña as a Research Center of the Galician University System and the project PID2022-137061OB-C21 (Ministerio de Ciencia e Innovación, Agencia Estatal de Investigación, Proyectos de Generación de Conocimiento; supported by the European Regional Development Fund). The authors also thank the funding of project PLEC2021-007662 (MCIN/AEI/10.13039/501100011033, Ministerio de Ciencia e Innovación, Agencia Estatal de Investigación, Plan de Recuperación, Transformación y Resiliencia, Unión Europea-Next Generation EU).