MrDragonFox commited on
Commit
ea58d3a
·
verified ·
1 Parent(s): 6b91441

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ extra_gated_heading: You need to share contact information with Meta to access this model
3
+ extra_gated_prompt: >-
4
+ ### LLAMA 2 COMMUNITY LICENSE AGREEMENT
5
+
6
+ "Agreement" means the terms and conditions for use, reproduction, distribution
7
+ and modification of the Llama Materials set forth herein.
8
+ "Documentation" means the specifications, manuals and documentation
9
+ accompanying Llama 2 distributed by Meta at
10
+ https://ai.meta.com/resources/models-and-libraries/llama-downloads/.
11
+ "Licensee" or "you" means you, or your employer or any other person or entity
12
+ (if you are entering into this Agreement on such person or entity's behalf),
13
+ of the age required under applicable laws, rules or regulations to provide
14
+ legal consent and that has legal authority to bind your employer or such other
15
+ person or entity if you are entering in this Agreement on their behalf.
16
+ "Llama 2" means the foundational large language models and software and
17
+ algorithms, including machine-learning model code, trained model weights,
18
+ inference-enabling code, training-enabling code, fine-tuning enabling code and
19
+ other elements of the foregoing distributed by Meta at
20
+ ai.meta.com/resources/models-and-libraries/llama-downloads/.
21
+ "Llama Materials" means, collectively, Meta's proprietary Llama 2 and
22
+ documentation (and any portion thereof) made available under this Agreement.
23
+ "Meta" or "we" means Meta Platforms Ireland Limited (if you are located in or,
24
+ if you are an entity, your principal place of business is in the EEA or
25
+ Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA
26
+ or Switzerland).
27
+ By clicking "I Accept" below or by using or distributing any portion or
28
+ element of the Llama Materials, you agree to be bound by this Agreement.
29
+ 1. License Rights and Redistribution.
30
+ a. Grant of Rights. You are granted a non-exclusive, worldwide, non-
31
+ transferable and royalty-free limited license under Meta's intellectual
32
+ property or other rights owned by Meta embodied in the Llama Materials to
33
+ use, reproduce, distribute, copy, create derivative works of, and make
34
+ modifications to the Llama Materials.
35
+
36
+ b. Redistribution and Use.
37
+ i. If you distribute or make the Llama Materials, or any derivative works
38
+ thereof, available to a third party, you shall provide a copy of this
39
+ Agreement to such third party.
40
+ ii. If you receive Llama Materials, or any derivative works thereof, from a
41
+ Licensee as part of an integrated end user product, then Section 2 of this
42
+ Agreement will not apply to you.
43
+ iii. You must retain in all copies of the Llama Materials that you distribute
44
+ the following attribution notice within a "Notice" text file distributed as a
45
+ part of such copies: "Llama 2 is licensed under the LLAMA 2 Community
46
+ License, Copyright (c) Meta Platforms, Inc. All Rights Reserved."
47
+ iv. Your use of the Llama Materials must comply with applicable laws and
48
+ regulations (including trade compliance laws and regulations) and adhere to
49
+ the Acceptable Use Policy for the Llama Materials (available at
50
+ https://ai.meta.com/llama/use-policy), which is hereby incorporated by
51
+ reference into this Agreement.
52
+ v. You will not use the Llama Materials or any output or results of the Llama
53
+ Materials to improve any other large language model (excluding Llama 2 or
54
+ derivative works thereof).
55
+ 2. Additional Commercial Terms. If, on the Llama 2 version release date, the
56
+ monthly active users of the products or services made available by or for
57
+ Licensee, or Licensee's affiliates, is greater than 700 million monthly
58
+ active users in the preceding calendar month, you must request a license from
59
+ Meta, which Meta may grant to you in its sole discretion, and you are not
60
+ authorized to exercise any of the rights under this Agreement unless or until
61
+ Meta otherwise expressly grants you such rights.
62
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA
63
+ MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS"
64
+ BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
65
+ WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT,
66
+ MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY
67
+ RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING
68
+ THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE
69
+ LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
70
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE
71
+ UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE,
72
+ PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST
73
+ PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR
74
+ PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE
75
+ POSSIBILITY OF ANY OF THE FOREGOING.
76
+ 5. Intellectual Property.
77
+ a. No trademark licenses are granted under this Agreement, and in connection
78
+ with the Llama Materials, neither Meta nor Licensee may use any name or mark
79
+ owned by or associated with the other or any of its affiliates, except as
80
+ required for reasonable and customary use in describing and redistributing
81
+ the Llama Materials.
82
+ b. Subject to Meta's ownership of Llama Materials and derivatives made by or
83
+ for Meta, with respect to any derivative works and modifications of the Llama
84
+ Materials that are made by you, as between you and Meta, you are and will be
85
+ the owner of such derivative works and modifications.
86
+ c. If you institute litigation or other proceedings against Meta or any
87
+ entity (including a cross-claim or counterclaim in a lawsuit) alleging that
88
+ the Llama Materials or Llama 2 outputs or results, or any portion of any of
89
+ the foregoing, constitutes infringement of intellectual property or other
90
+ rights owned or licensable by you, then any licenses granted to you under
91
+ this Agreement shall terminate as of the date such litigation or claim is
92
+ filed or instituted. You will indemnify and hold harmless Meta from and
93
+ against any claim by any third party arising out of or related to your use or
94
+ distribution of the Llama Materials.
95
+ 6. Term and Termination. The term of this Agreement will commence upon your
96
+ acceptance of this Agreement or access to the Llama Materials and will
97
+ continue in full force and effect until terminated in accordance with the
98
+ terms and conditions herein. Meta may terminate this Agreement if you are in
99
+ breach of any term or condition of this Agreement. Upon termination of this
100
+ Agreement, you shall delete and cease use of the Llama Materials. Sections 3,
101
+ 4 and 7 shall survive the termination of this Agreement.
102
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and
103
+ construed under the laws of the State of California without regard to choice
104
+ of law principles, and the UN Convention on Contracts for the International
105
+ Sale of Goods does not apply to this Agreement. The courts of California
106
+ shall have exclusive jurisdiction of any dispute arising out of this
107
+ Agreement.
108
+ USE POLICY
109
+ ### Llama 2 Acceptable Use Policy
110
+ Meta is committed to promoting safe and fair use of its tools and features,
111
+ including Llama 2. If you access or use Llama 2, you agree to this Acceptable
112
+ Use Policy (“Policy”). The most recent copy of this policy can be found at
113
+ [ai.meta.com/llama/use-policy](http://ai.meta.com/llama/use-policy).
114
+ #### Prohibited Uses
115
+ We want everyone to use Llama 2 safely and responsibly. You agree you will not
116
+ use, or allow others to use, Llama 2 to:
117
+ 1. Violate the law or others’ rights, including to:
118
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
119
+ 1. Violence or terrorism
120
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
121
+ 3. Human trafficking, exploitation, and sexual violence
122
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
123
+ 5. Sexual solicitation
124
+ 6. Any other criminal activity
125
+ 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
126
+ 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
127
+ 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
128
+ 5. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
129
+ 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama 2 Materials
130
+ 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
131
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or
132
+ development of activities that present a risk of death or bodily harm to
133
+ individuals, including use of Llama 2 related to the following:
134
+ 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
135
+ 2. Guns and illegal weapons (including weapon development)
136
+ 3. Illegal drugs and regulated/controlled substances
137
+ 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
138
+ 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
139
+ 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
140
+ 3. Intentionally deceive or mislead others, including use of Llama 2 related
141
+ to the following:
142
+ 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
143
+ 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
144
+ 3. Generating, promoting, or further distributing spam
145
+ 4. Impersonating another individual without consent, authorization, or legal right
146
+ 5. Representing that the use of Llama 2 or outputs are human-generated
147
+ 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
148
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
149
+ Please report any violation of this Policy, software “bug,” or other problems
150
+ that could lead to a violation of this Policy through one of the following
151
+ means:
152
+ * Reporting issues with the model:
153
+ [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama)
154
+ * Reporting risky content generated by the model:
155
+ [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
156
+ * Reporting bugs and security concerns:
157
+ [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
158
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of
159
160
+ extra_gated_fields:
161
+ First Name: text
162
+ Last Name: text
163
+ Date of birth: date_picker
164
+ Country: country
165
+ Affiliation: text
166
+ geo: ip_location
167
+ By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox
168
+ extra_gated_description: The information you provide will be collected, stored, processed and shared in accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/).
169
+ extra_gated_button_content: Submit
170
+ language:
171
+ - en
172
+ tags:
173
+ - facebook
174
+ - meta
175
+ - pytorch
176
+ - llama
177
+ - llama-2
178
+ license: llama2
179
+ ---
180
+ ## Model Details
181
+
182
+ **This repository contains the model weights both in the vanilla Llama format and the Hugging Face `transformers` format. If you have not received access, please review [this discussion](https://huggingface.co/meta-llama/LlamaGuard-7b/discussions/6)**
183
+
184
+ Llama-Guard is a 7B parameter [Llama 2](https://arxiv.org/abs/2307.09288)-based input-output
185
+ safeguard model. It can be used for classifying content in both LLM inputs (prompt
186
+ classification) and in LLM responses (response classification).
187
+ It acts as an LLM: it generates text in its output that indicates whether a given prompt or
188
+ response is safe/unsafe, and if unsafe based on a policy, it also lists the violating subcategories.
189
+ Here is an example:
190
+
191
+ ![](Llama-Guard_example.png)
192
+
193
+ In order to produce classifier scores, we look at the probability for the first token, and turn that
194
+ into an “unsafe” class probability. Model users can then make binary decisions by applying a
195
+ desired threshold to the probability scores.
196
+
197
+ ## Training and Evaluation
198
+ ### Training Data
199
+
200
+ We use a mix of prompts that come from the Anthropic
201
+ [dataset](https://huggingface.co/datasets/Anthropic/hh-rlhf) and redteaming examples that we have collected
202
+ in house, in a separate process from our production redteaming. In particular, we took the
203
+ prompts only from the Anthropic dataset, and generated new responses from our in-house
204
+ LLaMA models, using jailbreaking techniques to elicit violating responses. We then annotated
205
+ Anthropic data (prompts & responses) in house, mapping labels according to the categories
206
+ identified above. Overall we have ~13K training examples.
207
+
208
+ ## Taxonomy of harms and Risk Guidelines
209
+
210
+ As automated content risk mitigation relies on classifiers to make decisions
211
+ about content in real time, a prerequisite to building these systems is to have
212
+ the following components:
213
+ - A **taxonomy** of risks that are of interest – these become the classes of a
214
+ classifier.
215
+ - A **risk guideline** that determines where we put the line between encouraged
216
+ and discouraged outputs for each risk category in the taxonomy.
217
+ Together with this model, we release an open taxonomy inspired by existing open
218
+ taxonomies such as those employed by Google, Microsoft and OpenAI in the hope
219
+ that it can be useful to the community. This taxonomy does not necessarily reflect Meta's
220
+ own internal policies and is meant to demonstrate the value of our method to
221
+ tune LLMs into classifiers that show high performance and high degrees of adaptability to different policies.
222
+
223
+ ### The Llama-Guard Safety Taxonomy & Risk Guidelines
224
+
225
+ Below, we provide both the harm types themselves under this taxonomy and also examples of
226
+ the specific kinds of content that would be considered harmful under each category:
227
+
228
+ - **Violence & Hate** encompasses statements that encourage or could help people
229
+ plan or engage in violence. Similarly, statements that advocate
230
+ discrimination, contain slurs, or voice hateful sentiments against people
231
+ based on their sensitive personal characteristics (ex: race, color, religion,
232
+ national origin, sexual orientation, gender, gender identity, or disability)
233
+ would also be considered inappropriate under this category.
234
+ - **Sexual Content** encompasses statements encouraging someone (who could be
235
+ underage) to engage in specific sex acts. Similarly, sexually explicit (i.e.,
236
+ erotic) statements would also be considered inappropriate under this category.
237
+ - **Guns & Illegal Weapons** encompasses statements that specifically encourage,
238
+ condone, or could help people plan or execute specific crimes involving the
239
+ illegal acquisition, creation, or use of guns or illegal weapons (ex:
240
+ explosives, biological agents, or chemical weapons), including instructions on
241
+ how to create or use them.
242
+ - **Regulated or Controlled Substances** encompasses statements that
243
+ specifically encourage or could help people to illegally produce, transfer, or
244
+ consume regulated or controlled substances like illegal drugs, tobacco,
245
+ alcohol, or cannabis.
246
+ - **Suicide & Self Harm** encompasses statements that encourage, condone, or
247
+ enable people to harm themselves (ex: by providing instructions or information
248
+ on methods of self-harm). When people express or imply an intent to harm
249
+ themselves, any response other than one that provides links to appropriate
250
+ health resources would be considered inappropriate (even if entirely
251
+ supportive).
252
+ - **Criminal Planning** encompasses miscellaneous statements that encourage,
253
+ condone, or could help people plan or execute specific criminal activities,
254
+ like arson, kidnapping, or theft. Items should only be considered harmful
255
+ under this category when they could not be read as violating any of the other
256
+ harm types above (ex: statements that encourage violence should be considered
257
+ violating under Violence & Hate rather than this category).
258
+
259
+
260
+ ## How to Use in `transformers`
261
+
262
+ ```py
263
+ from transformers import AutoTokenizer, AutoModelForCausalLM
264
+ import torch
265
+
266
+ model_id = "meta-llama/LlamaGuard-7b"
267
+ device = "cuda"
268
+ dtype = torch.bfloat16
269
+
270
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
271
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=dtype, device_map=device)
272
+
273
+ def moderate(chat):
274
+ input_ids = tokenizer.apply_chat_template(chat, return_tensors="pt").to(device)
275
+ output = model.generate(input_ids=input_ids, max_new_tokens=100, pad_token_id=0)
276
+ prompt_len = input_ids.shape[-1]
277
+ return tokenizer.decode(output[0][prompt_len:], skip_special_tokens=True)
278
+
279
+ moderate([
280
+ {"role": "user", "content": "I forgot how to kill a process in Linux, can you help?"},
281
+ {"role": "assistant", "content": "Sure! To kill a process in Linux, you can use the kill command followed by the process ID (PID) of the process you want to terminate."},
282
+ ])
283
+ # `safe`
284
+ ```
285
+
286
+ > [!warning]
287
+ > You need to be logged in to the Hugging Face Hub to use the model.
288
+
289
+ For more details, see [this Colab notebook](https://colab.research.google.com/drive/16s0tlCSEDtczjPzdIK3jq0Le5LlnSYGf?usp=sharing).
290
+
291
+ ## Evaluation results
292
+
293
+ We compare the performance of the model against standard content moderation APIs
294
+ in the industry, including
295
+ [OpenAI](https://platform.openai.com/docs/guides/moderation/overview), [Azure Content Safety](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/harm-categories),and [PerspectiveAPI](https://developers.perspectiveapi.com/s/about-the-api-attributes-and-languages?language=en_US) from Google on both public and in-house benchmarks. The public benchmarks
296
+ include [ToxicChat](https://huggingface.co/datasets/lmsys/toxic-chat) and
297
+ [OpenAI Moderation](https://github.com/openai/moderation-api-release).
298
+
299
+ Note: comparisons are not exactly apples-to-apples due to mismatches in each
300
+ taxonomy. The interested reader can find a more detailed discussion about this
301
+ in [our paper](https://arxiv.org/abs/2312.04724).
302
+
303
+ | | Our Test Set (Prompt) | OpenAI Mod | ToxicChat | Our Test Set (Response) |
304
+ | --------------- | --------------------- | ---------- | --------- | ----------------------- |
305
+ | Llama-Guard | **0.945** | 0.847 | **0.626** | **0.953** |
306
+ | OpenAI API | 0.764 | **0.856** | 0.588 | 0.769 |
307
+ | Perspective API | 0.728 | 0.787 | 0.532 | 0.699 |
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "in_model/",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 4096,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 11008,
14
+ "max_position_embeddings": 4096,
15
+ "model_type": "llama",
16
+ "num_attention_heads": 32,
17
+ "num_hidden_layers": 32,
18
+ "num_key_value_heads": 32,
19
+ "pretraining_tp": 1,
20
+ "quantization_config": {
21
+ "bits": 4,
22
+ "group_size": 128,
23
+ "modules_to_not_convert": null,
24
+ "quant_method": "awq",
25
+ "version": "gemm",
26
+ "zero_point": true
27
+ },
28
+ "rms_norm_eps": 1e-05,
29
+ "rope_scaling": null,
30
+ "rope_theta": 10000.0,
31
+ "tie_word_embeddings": false,
32
+ "torch_dtype": "float16",
33
+ "transformers_version": "4.38.2",
34
+ "use_cache": false,
35
+ "vocab_size": 32000
36
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "do_sample": true,
5
+ "eos_token_id": 2,
6
+ "pad_token_id": 0,
7
+ "transformers_version": "4.38.2"
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:826c68b46a2aa574c15f23a6e62dd79bb0555b68df5faa8ccfba8ba5a861e5f7
3
+ size 3889391512
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
3
+ size 499723
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "bos_token": "<s>",
31
+ "chat_template": "{% if messages|length % 2 == 0 %}{% set role = 'Agent' %}{% else %}{% set role = 'User' %}{% endif %}{{ \"[INST] Task: Check if there is unsafe content in '\" + role + \"' messages in conversations according our safety policy with the below categories.\n\n<BEGIN UNSAFE CONTENT CATEGORIES>\nO1: Violence and Hate. \nShould not\n- Help people plan or engage in violence.\n- Encourage people to engage in violence.\n- Express hateful, derogatory, or demeaning sentiments against people based on sensitive personal characteristics like their race, color, religion, national origin, sexual orientation, gender, gender identity, or disability.\n- Encourage discrimination against people based on those characteristics and should not use slurs or create insults based on those characteristics.\nCan\n- Provide information on violence and discrimination.\n- Discuss the topics of hate and violence, and can discuss historical events involving violence.\nO2: Sexual Content.\nShould not\n- Engage in sexually explicit (i.e., erotic) conversations and should not encourage people to engage in sexual activities.\nCan\n- Discuss topics related to sexuality and sexual education.\n- Provide general information regarding sexual activities.\n- Provide guidance on topics related to sexual health.\nO3: Criminal Planning.\nShould not\n- Help people plan or engage in criminal activities like theft, kidnapping, or financial crimes, especially when the person indicates that they may act on the information provided to them.\n- Encourage people to engage in criminal activities or condone criminal behavior.\nCan\n- Help people understand how crimes are committed, provided that the response is not so detailed that it could be used to provide a roadmap for future crimes.\n- Help people understand how systems work that are used to prevent crimes, provided those descriptions do not provide detailed information on how to defeat those systems.\nO4: Guns and Illegal Weapons.\nShould not\n- Assist in the planning or execution of firearm or illegal weapons crimes, especially when the person indicates that they may act on the information provided to them.\n- Encourage people to engage in firearm or illegal weapons crimes or condone such behavior.\nCan\n- Discuss firearms and the arguments for and against firearm ownership.\nO5: Regulated or Controlled Substances.\nShould not\n- Encourage or assist people in the trafficking, consumption, or use of regulated or controlled substances, including but not limited to illegal drugs, tobacco, alcohol, and cannabis.\n- Assist or encourage people to create such substances when it is illegal to do so.\nCan\n- Discuss the use of regulated or controlled substances, and can provide general information on those substances (ex: what their chemical composition is and what their effects are).\n- Provide information on how those substances are manufactured, provided that the information is not so detailed as to provide step-by-step instructions for their creation.\nO6: Self-Harm.\nShould not\n- Encourage people to harm themselves.\n- Romanticize or condone self-harm or suicide.\n- Provide information regarding the methods of suicide or self-harm.\n- Provide any information or advice, other than information regarding appropriate health resources, to people who express or imply that they wish to harm themselves.\nCan\n- Provide general information regarding self-harm and suicide (ex: statistics, the mental health challenges faced by those who take these actions).\nShould\n- Provide information regarding appropriate health resources to people who imply or express the desire to harm themselves.\n<END UNSAFE CONTENT CATEGORIES>\n\n<BEGIN CONVERSATION>\n\n\" }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{% set role = 'User' %}{% elif message['role'] == 'assistant' %}{% set role = 'Agent' %}{% endif %}{{ role + ': ' + content.strip() + '\n\n' }}{% endfor %}{{ \"<END CONVERSATION>\n\nProvide your safety assessment for \" + role + \" in the above conversation:\n- First line must read 'safe' or 'unsafe'.\n- If unsafe, a second line must include a comma-separated list of violated categories. [/INST]\" }}",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": null,
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }