Spaces:
Runtime error
Runtime error
Merge branch 'main' into hf
Browse files- README.md +38 -49
- README_zh.md +71 -0
- llmriddles/questions/__init__.py +1 -1
- llmriddles/questions/level2.py +12 -12
- llmriddles/questions/level4.py +2 -2
README.md
CHANGED
@@ -13,14 +13,6 @@ python_version: 3.8
|
|
13 |
|
14 |
# LLM Riddles
|
15 |
|
16 |
-
<!-- <div align="center">
|
17 |
-
<br>
|
18 |
-
<a href="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg">
|
19 |
-
<img src="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg" width="1000" height="200" alt="Click to see the source">
|
20 |
-
</a>
|
21 |
-
<br>
|
22 |
-
</div> -->
|
23 |
-
|
24 |
<div align="center">
|
25 |
<br>
|
26 |
<a href="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg">
|
@@ -29,60 +21,57 @@ python_version: 3.8
|
|
29 |
<br>
|
30 |
</div>
|
31 |
|
32 |
-
## :thinking:
|
33 |
-
|
34 |
|
35 |
-
## :space_invader:
|
36 |
-
|
37 |
-
### ChatGPT +
|
38 |
```shell
|
39 |
QUESTION_LANG=cn QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
40 |
```
|
41 |
-
### ChatGPT +
|
42 |
```shell
|
43 |
QUESTION_LANG=en QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
44 |
```
|
45 |
-
### Mistral-7B-Instruct-v0.1 +
|
46 |
```shell
|
47 |
QUESTION_LANG=en QUESTION_LLM='mistral-7b' python3 -u app.py
|
48 |
```
|
49 |
-
## :technologist:
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
## :raising_hand:
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
-
|
58 |
-
-
|
59 |
-
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
- [
|
67 |
-
- [ ]
|
68 |
-
- [
|
69 |
-
- [
|
70 |
-
- [ ]
|
71 |
-
- [ ]
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
-
|
77 |
-
- 通过邮件与我们联系 ([email protected])
|
78 |
-
|
79 |
-
- 在OpenDILab的群组中加入讨论(通过 WeChat: ding314assist 添加小助手微信)
|
80 |
<img src=https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/wechat.jpeg width=35% />
|
81 |
|
82 |
## Special Thanks
|
83 |
-
-
|
84 |
-
-
|
85 |
-
-
|
86 |
|
87 |
## License
|
88 |
All code within this repository is under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
13 |
|
14 |
# LLM Riddles
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<div align="center">
|
17 |
<br>
|
18 |
<a href="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg">
|
|
|
21 |
<br>
|
22 |
</div>
|
23 |
|
24 |
+
## :thinking: What's This
|
25 |
+
Welcome to LLM Riddles! This is a game of wits and courage with language models. In the game, you need to construct questions that interact with the language model to get answers that meet the requirements. In this process, you can use your brain and use all the methods you can think of to get the model to output the results required by the answer.
|
26 |
|
27 |
+
## :space_invader: How to Play
|
28 |
+
We provide an online version for players to directly access and try out. Local deployment can be done in the following ways:
|
29 |
+
### ChatGPT + Chinese
|
30 |
```shell
|
31 |
QUESTION_LANG=cn QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
32 |
```
|
33 |
+
### ChatGPT + English
|
34 |
```shell
|
35 |
QUESTION_LANG=en QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
36 |
```
|
37 |
+
### Mistral-7B-Instruct-v0.1 + English
|
38 |
```shell
|
39 |
QUESTION_LANG=en QUESTION_LLM='mistral-7b' python3 -u app.py
|
40 |
```
|
41 |
+
## :technologist: Why Doing This
|
42 |
+
|
43 |
+
Our goal is to use this game to give participants a deeper understanding of the fascinating aspects of prompt engineering and natural language processing. This process will show players how to cleverly construct prompts and how to use them to trigger surprising responses from artificial intelligence systems, while also helping them better understand the incredible power of deep learning and natural language processing technologies. .
|
44 |
+
|
45 |
+
## :raising_hand: How to Submit a Custom Level
|
46 |
+
If you have interesting questions or ideas, players are welcome to submit their own ideas. You can [Initiate a Pull Request](https://github.com/opendilab/LLMRiddles/compare) and submit it to us. We will include it in the level after approval.
|
47 |
+
The question format should include the following points:
|
48 |
+
- Pull Request title, example: feature(username): Chapter X-Level Design
|
49 |
+
- The ID you want to be mentioned
|
50 |
+
- Modify the corresponding chapter question files
|
51 |
+
- Modification of init.py
|
52 |
+
|
53 |
+
For a complete example, please refer to: [Submit your own level design]()
|
54 |
+
|
55 |
+
## :writing_hand: Roadmap
|
56 |
+
|
57 |
+
- [x] Support custom levels
|
58 |
+
- [ ] Online trial link
|
59 |
+
- [ ] Hugging Face Space link
|
60 |
+
- [x] Support Mistral-7B(English version)
|
61 |
+
- [ ] Support Baichuan2-7B(Chinese version)
|
62 |
+
- [ ] Support LLaMA2-7B(English version)
|
63 |
+
- [ ] LLM inference speed optimization
|
64 |
+
|
65 |
+
## :speech_balloon: Feedback and Contribution
|
66 |
+
- [Start an Issue](https://github.com/opendilab/CodeMorpheus/issues/new/choose) on GitHub
|
67 |
+
- Contact us by email ([email protected])
|
68 |
+
- Discuss on OpenDILab's WeChat group (i.e. add us on WeChat: ding314assist)
|
|
|
|
|
|
|
69 |
<img src=https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/wechat.jpeg width=35% />
|
70 |
|
71 |
## Special Thanks
|
72 |
+
- Thanks to [Haoqiang Fan](https://www.zhihu.com/people/haoqiang-fan) for his original idea and title, which provided inspiration and motivation for the development and expansion of this project.
|
73 |
+
- Thanks to [HuggingFace](https://huggingface.co) for supporting and assisting the game.
|
74 |
+
- Thanks to [LLM Riddles contributors](https://github.com/opendilab/LLMRiddles/graphs/contributors) for their implementation and support.
|
75 |
|
76 |
## License
|
77 |
All code within this repository is under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
README_zh.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# LLM Riddles
|
2 |
+
|
3 |
+
<div align="center">
|
4 |
+
<br>
|
5 |
+
<a href="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg">
|
6 |
+
<img src="https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/banner.svg" width="1000" height="200" alt="Click to see the source">
|
7 |
+
</a>
|
8 |
+
<br>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
## :thinking: 什么是LLM Riddles
|
12 |
+
欢迎来到 LLM Riddles!这是一个与语言模型斗智斗勇的游戏。在游戏中,你需要构造与语言模型交互的问题,来得到符合要求的答案。在这个过程中,你可以开动脑筋,用你想到的所有方式,让模型输出答案要求的结果。
|
13 |
+
|
14 |
+
## :space_invader: 如何试玩
|
15 |
+
我们提供了在线版本以供玩家直接访问试玩,本地部署可以通过以下方式:
|
16 |
+
### ChatGPT + 中文
|
17 |
+
```shell
|
18 |
+
QUESTION_LANG=cn QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
19 |
+
```
|
20 |
+
### ChatGPT + 英文
|
21 |
+
```shell
|
22 |
+
QUESTION_LANG=en QUESTION_LLM='chatgpt' QUESTION_LLM_KEY=<your API key> python3 -u app.py
|
23 |
+
```
|
24 |
+
### LLaMA2-7b + 中文
|
25 |
+
```shell
|
26 |
+
QUESTION_LANG=cn QUESTION_LLM='llama2-7b' python3 -u app.py
|
27 |
+
```
|
28 |
+
### LLaMA2-7b + 英文
|
29 |
+
```shell
|
30 |
+
QUESTION_LANG=en QUESTION_LLM='llama2-7b' python3 -u app.py
|
31 |
+
```
|
32 |
+
## :technologist: 为什么制作这个游戏
|
33 |
+
|
34 |
+
我们的目标是通过这一游戏,让参与者深入领略到提示工程(prompt engineering)和自然语言处理的令人着迷之处。这个过程将向玩家们展示,如何巧妙地构建提示词(prompts),以及如何运用它们来引发人工智能系统的惊人反应,同时也帮助他们更好地理解深度学习和自然语言处理技术的不可思议之处。
|
35 |
+
|
36 |
+
## :raising_hand: 如何提交设计好的关卡
|
37 |
+
如果有好玩的问题或想法,欢迎玩家提交自己的创意,可以
|
38 |
+
[发起 Pull Request](https://github.com/opendilab/LLMRiddles/compare) 向我们提交, 我们会在审核通过后收录至关卡中。
|
39 |
+
问题的设计格式应包含以下几点:
|
40 |
+
- Pull Request标题,示例:feature(username): 章节X-关卡设计
|
41 |
+
- 希望被提及的ID
|
42 |
+
- 对应章节问题文件的修改
|
43 |
+
- init.py的修改
|
44 |
+
|
45 |
+
完整示例请参考:[提交属于自己的关卡设计]()
|
46 |
+
|
47 |
+
## :writing_hand: 未来计划
|
48 |
+
|
49 |
+
- [x] 支持自定义关卡
|
50 |
+
- [ ] 在线试玩链接
|
51 |
+
- [ ] Hugging Face Space 链接
|
52 |
+
- [ ] 支持LLaMA2-7B(英文)
|
53 |
+
- [ ] 支持Mistral-7B(英文)
|
54 |
+
- [ ] 支持Baichuan2-7B(中文)
|
55 |
+
- [ ] LLM 推理速度优化
|
56 |
+
|
57 |
+
## :speech_balloon: 反馈问题 & 提出建议
|
58 |
+
- 在 GitHub 上[发起 Issue](https://github.com/opendilab/CodeMorpheus/issues/new/choose)
|
59 |
+
- 通过邮件与我们联系 ([email protected])
|
60 |
+
- 在OpenDILab的群组中加入讨论(通过 WeChat: ding314assist 添加小助手微信)
|
61 |
+
<img src=https://github.com/opendilab/LLMRiddles/blob/main/llmriddles/assets/wechat.jpeg width=35% />
|
62 |
+
|
63 |
+
## Special Thanks
|
64 |
+
- 感谢 [Haoqiang Fan](https://www.zhihu.com/people/haoqiang-fan) 的原始创意和题目,为本项目的开发和扩展提供了灵感与动力。
|
65 |
+
- 感谢 [HuggingFace](https://huggingface.co) 对游戏的支持与协助。
|
66 |
+
- 感谢 [LLM Riddles contributors](https://github.com/opendilab/LLMRiddles/graphs/contributors) 的实现与支持。
|
67 |
+
|
68 |
+
## License
|
69 |
+
All code within this repository is under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
70 |
+
|
71 |
+
<p align="right">(<a href="#top">back to top</a>)</p>
|
llmriddles/questions/__init__.py
CHANGED
@@ -10,4 +10,4 @@ _ = _level1_file_
|
|
10 |
_ = _level2_file_
|
11 |
_ = _level3_file_
|
12 |
_ = _level4_file_
|
13 |
-
_ = _level5_file_
|
|
|
10 |
_ = _level2_file_
|
11 |
_ = _level3_file_
|
12 |
_ = _level4_file_
|
13 |
+
_ = _level5_file_
|
llmriddles/questions/level2.py
CHANGED
@@ -6,10 +6,10 @@ import sympy
|
|
6 |
from .question import register_question
|
7 |
|
8 |
CN_TEXT_1 = """
|
9 |
-
|
10 |
"""
|
11 |
EN_TEXT_1 = """
|
12 |
-
You need to come up with a question that has a prime number of words, so the answer's length is exactly the next prime number.
|
13 |
"""
|
14 |
|
15 |
|
@@ -63,10 +63,10 @@ register_question({
|
|
63 |
})
|
64 |
|
65 |
CN_TEXT_2 = """
|
66 |
-
|
67 |
"""
|
68 |
EN_TEXT_2 = """
|
69 |
-
Please enter a positive integer greater than one as a question, so that the answer contains a number that is at least one thousand more than it.
|
70 |
"""
|
71 |
|
72 |
|
@@ -111,10 +111,10 @@ register_question({
|
|
111 |
})
|
112 |
|
113 |
CN_TEXT_3 = """
|
114 |
-
|
115 |
"""
|
116 |
EN_TEXT_3 = """
|
117 |
-
Please enter a positive integer greater than one as a question, so that the answer contains at least 10 different natural numbers, each of them at least 1000 less than the question.
|
118 |
"""
|
119 |
|
120 |
|
@@ -170,10 +170,10 @@ register_question({
|
|
170 |
})
|
171 |
|
172 |
CN_TEXT_4 = """
|
173 |
-
|
174 |
"""
|
175 |
EN_TEXT_4 = """
|
176 |
-
Please make the model answer "114514" without mentioning the characters 1, 4, and 5, and without any extra characters.
|
177 |
"""
|
178 |
|
179 |
|
@@ -200,10 +200,10 @@ register_question({
|
|
200 |
})
|
201 |
|
202 |
CN_TEXT_5 = """
|
203 |
-
|
204 |
"""
|
205 |
EN_TEXT_5 = """
|
206 |
-
Please provide a square number greater than one as the question, and the answer should include the number corresponding to its square root.
|
207 |
"""
|
208 |
|
209 |
|
@@ -254,10 +254,10 @@ register_question({
|
|
254 |
})
|
255 |
|
256 |
CN_TEXT_6 = """
|
257 |
-
|
258 |
"""
|
259 |
EN_TEXT_6 = """
|
260 |
-
Please ask a question in under 10 words without the word "dog" and ensure that the word "dog" appears at least twice in the answer for each word in the question.
|
261 |
"""
|
262 |
|
263 |
|
|
|
6 |
from .question import register_question
|
7 |
|
8 |
CN_TEXT_1 = """
|
9 |
+
第二章第一题(质数长度),你需要提出一个字数是质数的问题,使回答的长度刚好是它的下一个质数。
|
10 |
"""
|
11 |
EN_TEXT_1 = """
|
12 |
+
For the first question in chapter 2, You need to come up with a question that has a prime number of words, so the answer's length is exactly the next prime number.
|
13 |
"""
|
14 |
|
15 |
|
|
|
63 |
})
|
64 |
|
65 |
CN_TEXT_2 = """
|
66 |
+
第二章第二题(越说越大),请输入一个大于一的正整数作为问题,使回答里包含至少比它大一千的数。
|
67 |
"""
|
68 |
EN_TEXT_2 = """
|
69 |
+
For the second question in chapter 2, Please enter a positive integer greater than one as a question, so that the answer contains a number that is at least one thousand more than it.
|
70 |
"""
|
71 |
|
72 |
|
|
|
111 |
})
|
112 |
|
113 |
CN_TEXT_3 = """
|
114 |
+
第二章第三题(越说越小),请输入一个大于一的正整数作为问题,使回答里包含至少10个不同的至少比它小一千的自然数。
|
115 |
"""
|
116 |
EN_TEXT_3 = """
|
117 |
+
For the third question in chapter 2, Please enter a positive integer greater than one as a question, so that the answer contains at least 10 different natural numbers, each of them at least 1000 less than the question.
|
118 |
"""
|
119 |
|
120 |
|
|
|
170 |
})
|
171 |
|
172 |
CN_TEXT_4 = """
|
173 |
+
第二章第四题(警世名言),请在不提及1,4,5这三个字符的情况下让模型回答114514,不要有多余的字符。
|
174 |
"""
|
175 |
EN_TEXT_4 = """
|
176 |
+
For the fourth question in chapter 2, Please make the model answer "114514" without mentioning the characters 1, 4, and 5, and without any extra characters.
|
177 |
"""
|
178 |
|
179 |
|
|
|
200 |
})
|
201 |
|
202 |
CN_TEXT_5 = """
|
203 |
+
第二章第五题(开平方数),请输入一个大于一的平方数作为问题,使回答里包含它的平方根对应的数。
|
204 |
"""
|
205 |
EN_TEXT_5 = """
|
206 |
+
For the fifth question in chapter 2, Please provide a square number greater than one as the question, and the answer should include the number corresponding to its square root.
|
207 |
"""
|
208 |
|
209 |
|
|
|
254 |
})
|
255 |
|
256 |
CN_TEXT_6 = """
|
257 |
+
第二章第六题(得寸进狗),请提一个不包含“狗”这个字的10个字以内的问题,使回答中“狗”这个字出现的次数至少是问题字数的2倍。
|
258 |
"""
|
259 |
EN_TEXT_6 = """
|
260 |
+
For the sixth question in chapter 2, Please ask a question in under 10 words without the word "dog" and ensure that the word "dog" appears at least twice in the answer for each word in the question.
|
261 |
"""
|
262 |
|
263 |
|
llmriddles/questions/level4.py
CHANGED
@@ -65,13 +65,13 @@ def get_all_numbers_in_a_sentence(text: str):
|
|
65 |
|
66 |
|
67 |
CN_TEXT_3 = """
|
68 |
-
|
69 |
|
70 |
请在下面的输入框内填写你构造并点击按钮提交。
|
71 |
"""
|
72 |
|
73 |
EN_TEXT_3 = """
|
74 |
-
For the
|
75 |
|
76 |
Please enter your query below and click the submit button
|
77 |
"""
|
|
|
65 |
|
66 |
|
67 |
CN_TEXT_3 = """
|
68 |
+
第四章第一题(自然之密),请输入一个大于一的正整数作为问题,使回答里包含和它刚好相差1的数。
|
69 |
|
70 |
请在下面的输入框内填写你构造并点击按钮提交。
|
71 |
"""
|
72 |
|
73 |
EN_TEXT_3 = """
|
74 |
+
For the first question in chapter 4, please enter a positive integer greater than one as the question so that the answer contains a number that is exactly 1 different from it.
|
75 |
|
76 |
Please enter your query below and click the submit button
|
77 |
"""
|