Jlonge4 commited on
Commit
0523e41
1 Parent(s): c3829ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -28,6 +28,47 @@ Our merged model demonstrates exceptional performance on the toxicity classifica
28
  weighted avg 0.87 0.87 0.87 350
29
  ```
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  Our model achieves an impressive precision of 0.85 for the toxic class and 0.89 for the non-toxic class, with a high overall accuracy of 0.87. The balanced F1-scores of 0.87 for both classes demonstrate the model's ability to handle this binary classification task effectively.
32
 
33
  ### Comparison with Other Models
 
28
  weighted avg 0.87 0.87 0.87 350
29
  ```
30
 
31
+ ### Model Usage
32
+ For best results, we recommend starting with the following prompting strategy (and encourage tweaks as you see fit):
33
+
34
+ ```python
35
+ def format_input_classification(text):
36
+ input = f"""
37
+ You are examining written text content. Here is the text:
38
+ ************
39
+ [Text]: {text}
40
+ ************
41
+
42
+ Examine the text and determine whether the text is toxic or not. Toxicity is
43
+ defined as any comment that makes hateful statements, demeans or disparages
44
+ another user, uses inappropriate language, or threatens physical or emotional
45
+ violence. Please focus heavily on the concept of toxicity and do NOT mark
46
+ something toxic as non-toxic that is toxic.
47
+
48
+ Your classification must be single word followed by a reasoning as to why you chose
49
+ the classification, either "toxic" or "non-toxic".
50
+ "toxic" means that the text meets the definition of toxic.
51
+ "non-toxic" means the text does not contain any
52
+ words, sentiments or meaning that could be considered toxic.
53
+
54
+ After your classification, provide the reason for your classification.
55
+ """
56
+ return input
57
+
58
+
59
+ text = format_input_classification("I could strangle him")
60
+ messages = [
61
+ {"role": "user", "content": text}
62
+ ]
63
+
64
+ pipe = pipeline(
65
+ "text-generation",
66
+ model=base_model,
67
+ model_kwargs={"attn_implementation": attn_implementation, "torch_dtype": torch.float16},
68
+ tokenizer=tokenizer,
69
+ )
70
+ ```
71
+
72
  Our model achieves an impressive precision of 0.85 for the toxic class and 0.89 for the non-toxic class, with a high overall accuracy of 0.87. The balanced F1-scores of 0.87 for both classes demonstrate the model's ability to handle this binary classification task effectively.
73
 
74
  ### Comparison with Other Models