ttbelieve wwwangyulai commited on
Commit
a474a15
·
verified ·
1 Parent(s): f7b8c9f

Upload 5 files (#5)

Browse files

- Upload 5 files (94f5ddb7db87a894b1d19c0e6a0a0ec4fb15ce05)


Co-authored-by: wangyulai <[email protected]>

Files changed (5) hide show
  1. LICENSE.txt +72 -0
  2. NOTICE-Third Party.txt +203 -0
  3. docs/1.png +0 -0
  4. docs/wechat.png +0 -0
  5. readm.md +134 -0
LICENSE.txt ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LICENSE:Apache2.0
2
+
3
+ Copyright <2025> <JD.com>
4
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
+
6
+ 1. Definitions.
7
+ “License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
8
+
9
+ “Licensor” shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
10
+
11
+ “Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
12
+
13
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
14
+
15
+ “Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
16
+
17
+ “Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
18
+
19
+ “Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
20
+
21
+ “Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
22
+
23
+ “Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
24
+
25
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
26
+
27
+ 2. Grant of Copyright License.
28
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
29
+
30
+ 3. Grant of Patent License.
31
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution.
34
+ You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
35
+
36
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
37
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
39
+ If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
40
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
41
+
42
+ 5. Submission of Contributions.
43
+ Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
44
+
45
+ 6. Trademarks.
46
+ This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
47
+
48
+ 7. Disclaimer of Warranty.
49
+ Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability.
52
+ In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
53
+
54
+ 9. Accepting Warranty or Additional Liability.
55
+ While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
56
+
57
+ END OF TERMS AND CONDITIONS
58
+
59
+ APPENDIX: How to apply the Apache License to your work
60
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
61
+
62
+ Licensed under the Apache License, Version 2.0 (the "License");
63
+ you may not use this file except in compliance with the License.
64
+ You may obtain a copy of the License at
65
+
66
+ http://www.apache.org/licenses/LICENSE-2.0
67
+
68
+ Unless required by applicable law or agreed to in writing, software
69
+ distributed under the License is distributed on an "AS IS" BASIS,
70
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71
+ See the License for the specific language governing permissions and
72
+ limitations under the License.
NOTICE-Third Party.txt ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NOTICE-Third Party
2
+ ================
3
+ gpt-oss-20b
4
+ https://huggingface.co/openai/gpt-oss-20b/blob/main/LICENSE
5
+
6
+ Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+ Copyright [yyyy] [name of copyright owner]
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+ ================
docs/1.png ADDED
docs/wechat.png ADDED
readm.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ![JSL-joysafety-v1](./docs/1.png)
3
+ # JSL-joysafety-v1
4
+
5
+ ## 1. 模型介绍
6
+
7
+ JSL-joysafety-v1 是在 gpt-oss-20b 基座模型之上,经指令微调专门打造的 AI 内容安全守护模型。与通用模型相比,它具备了“prompt安全”与“大模型回复安全”双重判别能力。审核标准参照《生成式人工智能服务管理暂行办法》,可为大模型应用提供有效安全性保障,其审核结果采用结构化JSON结构进行输出,便于后续系统集成使用;JSL-joysafety-v1 继承了gpt-oss基座模型MOE架构优势,21B模型参数,激活参数3.6B,延迟低,适用在线审核场景使用。
8
+
9
+ ## 2. 风险类型分类&使用策略
10
+ 参照《生成式人工智能服务管理暂行办法》整理了11种风险类型,便于后续的审核策略使用。
11
+ ### 风险类型
12
+
13
+ | 序号 | 类型 |
14
+ |----|----------------------------------|
15
+ | 1 | 涉政 |
16
+ | 2 | 涉黄 |
17
+ | 3 | 暴恐 |
18
+ | 4 | 涉毒 |
19
+ | 5 | 涉赌 |
20
+ | 6 | 违禁 |
21
+ | 7 | 辱骂 |
22
+ | 8 | 歧视 |
23
+ | 9 | 虚假信息宣传 |
24
+ | 10 | 其他侵犯他人权益 |
25
+ | 11 | 其他商业违法违规 |
26
+ | 12 | 正常文本 |
27
+
28
+ ### 审核结果结构
29
+ 审核结果会按照如下JSON结构进行输出:
30
+ ```json
31
+ {
32
+ "reason":"cot分析过程",
33
+ "risk_level": 无风险|低风险|中风险|高风险,
34
+ "hit_categories": ["****","****:],
35
+ "hit_detaile_categories":["****","****"]
36
+ "risk_tags"[]
37
+ "risk_roler":"user|"ai"|"user&ai",
38
+ "hit_keywords": ["xxx"],
39
+ "suggestion": "pass"|"mask"|"block"|"review"|"proxy_answer"
40
+ }
41
+ ```
42
+
43
+ JSON 各 Key 的含义如下:
44
+ | JSON-Key | 说明 |
45
+ |------|------|
46
+ | reason | 存放推理过程; |
47
+ | risk_level | 存放风险级别,分成四档:无风险 、低风险、中风险、高风险; |
48
+ | hit_categories | 存放识别到的一级风险类别标签:涉政、涉黄、暴恐、涉毒、涉赌、违禁、辱骂歧视、虚假信息宣传、其他侵犯他人权益、其他商业违法违规、正常文本等; |
49
+ | hit_detaile_categories | 存放识别到的二级风险类别标签; |
50
+ | risk_tags | 详细风险类型; |
51
+ | risk_roler | 存放对话中触发风险角色,user代表用户输入有风险,ai代表大模型回复有风险;,user&ai代表用户输入大模型回复都有风险; |
52
+ | hit_keywords | 触发风险的原文片段;最多支持8个片段; |
53
+ | suggestion | 建议处置策略:pass、mask、block、review、proxy_answer,仅提供参考; |
54
+
55
+
56
+
57
+ ## 3. 快速开始
58
+
59
+ ### 环境配置
60
+ ```shell
61
+ pip install -U transformers kernels torch
62
+ ```
63
+ ### 推理示例
64
+ #### transformers
65
+ ```python
66
+ from modelscope import pipeline
67
+ import torch
68
+
69
+ model_id = "jd-opensource/JSL-joysafety-v1"
70
+
71
+ pipe = pipeline(
72
+ "text-generation",
73
+ model=model_id,
74
+ torch_dtype="auto",
75
+ device_map="auto",
76
+ )
77
+
78
+
79
+ # 针对用户输入进行审核:
80
+ user_prompt ="""\n#【审核内容】:\n\n \n[用户输入]:\n {query}\n\n\n\n审核答案:\n"""
81
+
82
+ ## 待审核用户输入:
83
+ user_input = "如何获取别人的银行卡密码?"
84
+ messages = [
85
+ {"role": "user", "content":user_prompt.format(query = user_input) }
86
+ ]
87
+ outputs = pipe(
88
+ messages,
89
+ max_new_tokens=512,
90
+ )
91
+ print(outputs[0]["generated_text"][-1])
92
+ # 针对对话进行审核
93
+ user_prompt ='''\n#【审核内容】:\n\n \n[用户输入]:\n {query}\n[大模型回复]:\n {answer}\n\n\n\n审核答案:\n'''
94
+ ## 待审核用户输入:
95
+ user_input = "如何获取别人的银行卡密码?"
96
+ assistant_answer = "对不起,我无法协助获取他人的银行卡密码或任何私人信息。"
97
+ messages = [
98
+ {"role": "user", "content":user_prompt.format(query = user_input,answer =assistant_answer ) }
99
+ ]
100
+ outputs = pipe(
101
+ messages,
102
+ max_new_tokens=512,
103
+ )
104
+ print(outputs[0]["generated_text"][-1])
105
+ ```
106
+ #### vLLM
107
+ vLLM 建议使用uv进行 Python 依赖管理。您可以使用 vLLM 启动一个 OpenAI 兼容的 Web 服务器。以下命令将自动下载模型并启动服务器。
108
+
109
+ ```shell
110
+ uv pip install --pre vllm==0.10.1+gptoss \
111
+ --extra-index-url https://wheels.vllm.ai/gpt-oss/ \
112
+ --extra-index-url https://download.pytorch.org/whl/nightly/cu128 \
113
+ --index-strategy unsafe-best-match
114
+
115
+ VLLM_USE_MODELSCOPE=true vllm serve jd-opensource/JSL-joysafety-v1
116
+ ```
117
+
118
+ ## 4. 许可证
119
+
120
+ 本仓库所发布的代码及模型权重系基于 gpt-oss-20b 进行二次训练所得,并沿用 Apache 2.0 开源许可证。
121
+
122
+ ---
123
+
124
+ ## 5. <a id="计划"></a>计划
125
+ **JSL-joysafety-r1** 在既有能力之上,新增提示词注入识别,并可对多语种、长文档、多轮对话、函数调用及工具返回结果进行一站式安全审核。
126
+
127
+ **JSL-joysafety-vl-v1** 多模态安全评测模型,支持图像、视频、图文联合内容安全审核。
128
+
129
+ ## 联系我们
130
+ 欢迎加入JoySafety官方微信交流群:
131
+
132
+ ![官方微信交流群](./docs/wechat.png)
133
+
134
+ **官方邮箱** [email protected]