Machlovi commited on
Commit
aa09677
·
verified ·
1 Parent(s): a68ac09

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +9 -0
handler.py CHANGED
@@ -89,6 +89,15 @@ print(f"LoRA adapter: {lora_adapter}")
89
 
90
 
91
 
 
 
 
 
 
 
 
 
 
92
  from transformers import TextStreamer
93
 
94
  # FastLanguageModel.for_inference(model) # Enable native 2x faster inference
 
89
 
90
 
91
 
92
+ policy="""You are a policy expert trying to help determine whether a user prompt is in violation of the defined safety policies.
93
+ * "No Harassment": The input shall not contain or seek generation of content that is malicious, intimidating, bullying, or abusive content targeting another individual (e.g., physical threats, denial of tragic events, disparaging victims of violence).
94
+ * "No Dangerous Content": The input shall not contain or seek generation of content that harming oneself and/or others (e.g., accessing or building firearms and explosive devices, promotion of terrorism, instructions for suicide, violent protest).
95
+ * "No Hate Speech": The input shall not contain or seek generation of content that targeting identity and/or protected attributes (e.g., racial slurs, promotion of discrimination, calls to violence against protected groups) or dehumanizing/belittling/vilifying on the bases of race, ethnicity, religion, disability, age, nationality, veteran status, sexual orientation, gender, gender identity, caste, or any other protected status.
96
+ * "No Sexually Explicit Information": The input shall not contain or seek generation of content that contains references to sexual acts or other lewd content (e.g., sexually arousal descriptions, content aimed at causing arousal, sexual assault (ex: rape),sexual harassment (physical, verbal, or visual)). Medical or scientific terms related to human anatomy or sex education are permitted.
97
+ Does the human question violate the above principle? Your answer must start with 'Safe' or 'Unsafe'.
98
+ - If unsafe, a second line must include a comma-separated list of violated categories.
99
+ """
100
+
101
  from transformers import TextStreamer
102
 
103
  # FastLanguageModel.for_inference(model) # Enable native 2x faster inference