Spaces:
Runtime error
Runtime error
niuyazhe
commited on
Commit
•
a8a481c
1
Parent(s):
54390f8
polish(nyz): polish description and add queue
Browse files
README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<br>
|
9 |
</div>
|
10 |
|
11 |
-
## :thinking: 什么是
|
12 |
欢迎来到 LLM Riddles!这是一个与语言模型斗智斗勇的游戏。在游戏中,你需要构造与语言模型交互的问题,来得到符合要求的答案。在这个过程中,你可以开动脑筋,用你想到的所有方式,让模型输出答案要求的结果。
|
13 |
|
14 |
## :space_invader: 如何试玩
|
@@ -31,7 +31,7 @@ QUESTION_LANG=en QUESTION_LLM='llama2-7b' python3 -u app.py
|
|
31 |
```
|
32 |
## :technologist: 为什么制作这个游戏
|
33 |
|
34 |
-
我们的目标是通过这一游戏,让参与者深入领略到提示工程(prompt engineering
|
35 |
|
36 |
## :raising_hand: 如何提交设计好的关卡
|
37 |
如果有好玩的问题或想法,欢迎玩家提交自己的创意,可以通过
|
@@ -39,28 +39,28 @@ QUESTION_LANG=en QUESTION_LLM='llama2-7b' python3 -u app.py
|
|
39 |
|
40 |
## :writing_hand: 未来计划
|
41 |
|
42 |
-
- [x]
|
43 |
-
- [
|
44 |
-
- [ ]
|
45 |
-
- [ ]
|
46 |
-
- [ ]
|
47 |
-
- [ ]
|
48 |
-
- [ ]
|
49 |
|
50 |
|
51 |
## :speech_balloon: 反馈问题 & 提出建议
|
52 |
-
- [发起 Issue](https://github.com/opendilab/CodeMorpheus/issues/new/choose)
|
53 |
- 通过邮件与我们联系 (opendilab@pjlab.org.cn)
|
54 |
|
55 |
- 在OpenDILab的群组中加入讨论(通过 WeChat: ding314assist 添加小助手微信)
|
56 |
<img src=https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/wechat.jpeg width=35% />
|
57 |
|
58 |
## Special Thanks
|
59 |
-
- 感谢[
|
60 |
-
- 感谢[
|
61 |
-
- 感谢[LLM Riddles contributors](https://github.com/opendilab/LLMRiddles/graphs/contributors)的实现与支持。
|
62 |
|
63 |
## License
|
64 |
All code within this repository is under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
65 |
|
66 |
-
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
|
8 |
<br>
|
9 |
</div>
|
10 |
|
11 |
+
## :thinking: 什么是LLM Riddles
|
12 |
欢迎来到 LLM Riddles!这是一个与语言模型斗智斗勇的游戏。在游戏中,你需要构造与语言模型交互的问题,来得到符合要求的答案。在这个过程中,你可以开动脑筋,用你想到的所有方式,让模型输出答案要求的结果。
|
13 |
|
14 |
## :space_invader: 如何试玩
|
|
|
31 |
```
|
32 |
## :technologist: 为什么制作这个游戏
|
33 |
|
34 |
+
我们的目标是通过这一游戏,让参与者深入领略到提示工程(prompt engineering)和自然语言处理的令人着迷之处。这个过程将向玩家们展示,如何巧妙地构建提示词(prompts),以及如何运用它们来引发人工智能系统的惊人反应,同时也帮助他们更好地理解深度学习和自然语言处理技术的不可思议之处。
|
35 |
|
36 |
## :raising_hand: 如何提交设计好的关卡
|
37 |
如果有好玩的问题或想法,欢迎玩家提交自己的创意,可以通过
|
|
|
39 |
|
40 |
## :writing_hand: 未来计划
|
41 |
|
42 |
+
- [x] 支持自定义关卡
|
43 |
+
- [ ] 在线试玩链接
|
44 |
+
- [ ] Hugging Face Space 链接
|
45 |
+
- [ ] 支持LLaMA2-7B(英文)
|
46 |
+
- [ ] 支持Mistral-7B(英文)
|
47 |
+
- [ ] 支持Baichuan2-7B(中文)
|
48 |
+
- [ ] LLM 推理速度优化
|
49 |
|
50 |
|
51 |
## :speech_balloon: 反馈问题 & 提出建议
|
52 |
+
- 在 GitHub 上[发起 Issue](https://github.com/opendilab/CodeMorpheus/issues/new/choose)
|
53 |
- 通过邮件与我们联系 (opendilab@pjlab.org.cn)
|
54 |
|
55 |
- 在OpenDILab的群组中加入讨论(通过 WeChat: ding314assist 添加小助手微信)
|
56 |
<img src=https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/wechat.jpeg width=35% />
|
57 |
|
58 |
## Special Thanks
|
59 |
+
- 感谢 [Haoqiang Fan](https://www.zhihu.com/people/haoqiang-fan) 的原始创意和题目,为本项目的开发和扩展提供了灵感与动力。
|
60 |
+
- 感谢 [HuggingFace](https://huggingface.co) 对游戏的支持与协助。
|
61 |
+
- 感谢 [LLM Riddles contributors](https://github.com/opendilab/LLMRiddles/graphs/contributors) 的实现与支持。
|
62 |
|
63 |
## License
|
64 |
All code within this repository is under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
65 |
|
66 |
+
<p align="right">(<a href="#top">back to top</a>)</p>
|
app.py
CHANGED
@@ -17,23 +17,23 @@ _LLM_KEY = os.environ.get('QUESTION_LLM_KEY', None)
|
|
17 |
if _LANG == "cn":
|
18 |
title = "完蛋!我被 LLM 拿捏了"
|
19 |
requirement_ph = """
|
20 |
-
|
21 |
|
22 |
-
|
23 |
|
24 |
-
点击\"下一题\"
|
25 |
"""
|
26 |
requirement_label = "游戏须知/说明"
|
27 |
question_ph = "你对大语言模型的提问"
|
28 |
-
question_label = "
|
29 |
answer_ph = "大语言模型的回答"
|
30 |
-
answer_label = "
|
31 |
submit_label = "提交"
|
32 |
next_label = "下一题"
|
33 |
api_ph = "你个人的大语言模型 API Key (例如:ChatGPT)"
|
34 |
api_label = "API key"
|
35 |
predict_label = "结果正确性"
|
36 |
-
explanation_label = "
|
37 |
game_cleared_label = "祝贺!你已成功通关!"
|
38 |
correct_label = "正确"
|
39 |
wrong_label = "错误"
|
@@ -43,20 +43,20 @@ if _LANG == "cn":
|
|
43 |
<div align="center">
|
44 |
<img src="https://raw.githubusercontent.com/opendilab/LLMRiddles/main/llmriddles/assets/banner.svg" width="80%" height="20%" alt="Banner Image">
|
45 |
</div>
|
46 |
-
<h2 style="text-align: center; color: black;"><a href="https://github.com/OpenDILab"> 🎭LLM Riddles
|
47 |
<h4 align="center"> 如果你喜欢这个项目,请给我们在 GitHub 点个 star ✨ 。我们将会持续保持更新。再次感谢游戏<a href="https://www.zhihu.com/people/haoqiang-fan"> 原作者 </a>的奇思妙想! </h4>
|
48 |
<strong><h5 align="center">注意:算法模型的输出可能包含一定的随机性。相关结果不代表任何开发者和相关 AI 服务的态度和意见。本项目开发者不对生成结果作任何保证,仅供娱乐。<h5></strong>
|
49 |
"""
|
50 |
tos_markdown = """
|
51 |
### 使用条款
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
**版权所有 2023 OpenDILab。**
|
57 |
"""
|
58 |
elif _LANG == "en":
|
59 |
-
title = "LLM Riddles"
|
60 |
requirement_ph = """
|
61 |
Welcome to LLM Riddles!
|
62 |
|
@@ -90,9 +90,9 @@ elif _LANG == "en":
|
|
90 |
"""
|
91 |
tos_markdown = """
|
92 |
### Terms of use
|
93 |
-
By using this service,
|
94 |
The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research.
|
95 |
-
Please send email to
|
96 |
For an optimal experience, please use desktop computers for this demo, as mobile devices may compromise its quality.
|
97 |
**Copyright 2023 OpenDILab.**
|
98 |
"""
|
@@ -154,7 +154,6 @@ if __name__ == '__main__':
|
|
154 |
gr.Button(next_label, interactive=False), \
|
155 |
uuid_
|
156 |
|
157 |
-
|
158 |
gr_next.click(
|
159 |
fn=_next_question,
|
160 |
inputs=[gr_uuid],
|
@@ -181,11 +180,11 @@ if __name__ == '__main__':
|
|
181 |
else:
|
182 |
return answer_text, labels, explanation, gr.Button(next_label, interactive=False), uuid_
|
183 |
|
184 |
-
|
185 |
gr_submit.click(
|
186 |
_submit_answer,
|
187 |
inputs=[gr_question, gr_api_key, gr_uuid],
|
188 |
outputs=[gr_answer, gr_predict, gr_explanation, gr_next, gr_uuid],
|
189 |
)
|
190 |
|
191 |
-
|
|
|
|
17 |
if _LANG == "cn":
|
18 |
title = "完蛋!我被 LLM 拿捏了"
|
19 |
requirement_ph = """
|
20 |
+
欢迎来到 LLM Riddles!
|
21 |
|
22 |
+
你将通过本游戏对大语言模型产生更深刻的理解。在本游戏中,你需要构造一个提给语言大模型的问题,使得它回复的答案符合题目要求。
|
23 |
|
24 |
+
点击\"下一题\"即可开始游戏
|
25 |
"""
|
26 |
requirement_label = "游戏须知/说明"
|
27 |
question_ph = "你对大语言模型的提问"
|
28 |
+
question_label = "玩家提问栏"
|
29 |
answer_ph = "大语言模型的回答"
|
30 |
+
answer_label = "大语言模型回答栏"
|
31 |
submit_label = "提交"
|
32 |
next_label = "下一题"
|
33 |
api_ph = "你个人的大语言模型 API Key (例如:ChatGPT)"
|
34 |
api_label = "API key"
|
35 |
predict_label = "结果正确性"
|
36 |
+
explanation_label = "结果详细解释"
|
37 |
game_cleared_label = "祝贺!你已成功通关!"
|
38 |
correct_label = "正确"
|
39 |
wrong_label = "错误"
|
|
|
43 |
<div align="center">
|
44 |
<img src="https://raw.githubusercontent.com/opendilab/LLMRiddles/main/llmriddles/assets/banner.svg" width="80%" height="20%" alt="Banner Image">
|
45 |
</div>
|
46 |
+
<h2 style="text-align: center; color: black;"><a href="https://github.com/OpenDILab"> 🎭LLM Riddles:完蛋!我被 LLM 拿捏了</a></h2>
|
47 |
<h4 align="center"> 如果你喜欢这个项目,请给我们在 GitHub 点个 star ✨ 。我们将会持续保持更新。再次感谢游戏<a href="https://www.zhihu.com/people/haoqiang-fan"> 原作者 </a>的奇思妙想! </h4>
|
48 |
<strong><h5 align="center">注意:算法模型的输出可能包含一定的随机性。相关结果不代表任何开发者和相关 AI 服务的态度和意见。本项目开发者不对生成结果作任何保证,仅供娱乐。<h5></strong>
|
49 |
"""
|
50 |
tos_markdown = """
|
51 |
### 使用条款
|
52 |
+
玩家使用本服务须同意以下条款:
|
53 |
+
该服务是一项探索性研究预览版,仅供非商业用途。它仅提供有限的安全措施,并可能生成令人反感的内容。不得将其用于任何非法、有害、暴力、种族主义等目的。该服务可能会收集玩家对话数据以供未来研究之用。
|
54 |
+
如果您的游玩体验有不佳之处,请发送邮件至 opendilab@pjlab.org.cn ! 我们将删除相关信息,并不断改进这个项目。
|
55 |
+
为了获得最佳体验,请使用台式电脑进行此预览版游戏,因为移动设备可能会影响可视化效果。
|
56 |
**版权所有 2023 OpenDILab。**
|
57 |
"""
|
58 |
elif _LANG == "en":
|
59 |
+
title = "LLM Riddles: Oops! Rolling in LLM."
|
60 |
requirement_ph = """
|
61 |
Welcome to LLM Riddles!
|
62 |
|
|
|
90 |
"""
|
91 |
tos_markdown = """
|
92 |
### Terms of use
|
93 |
+
By using this service, players are required to agree to the following terms:
|
94 |
The service is a research preview intended for non-commercial use only. It only provides limited safety measures and may generate offensive content. It must not be used for any illegal, harmful, violent, racist, or sexual purposes. The service may collect user dialogue data for future research.
|
95 |
+
Please send email to opendilab@pjlab.org.cn if you get any inappropriate answer! We will delete those and keep improving our moderator.
|
96 |
For an optimal experience, please use desktop computers for this demo, as mobile devices may compromise its quality.
|
97 |
**Copyright 2023 OpenDILab.**
|
98 |
"""
|
|
|
154 |
gr.Button(next_label, interactive=False), \
|
155 |
uuid_
|
156 |
|
|
|
157 |
gr_next.click(
|
158 |
fn=_next_question,
|
159 |
inputs=[gr_uuid],
|
|
|
180 |
else:
|
181 |
return answer_text, labels, explanation, gr.Button(next_label, interactive=False), uuid_
|
182 |
|
|
|
183 |
gr_submit.click(
|
184 |
_submit_answer,
|
185 |
inputs=[gr_question, gr_api_key, gr_uuid],
|
186 |
outputs=[gr_answer, gr_predict, gr_explanation, gr_next, gr_uuid],
|
187 |
)
|
188 |
|
189 |
+
concurrency = int(os.environ.get('CONCURRENCY', os.cpu_count()))
|
190 |
+
demo.queue().launch(max_threads=concurrency)
|