add 5 problems (#638)

---------

Co-authored-by: wenmeng.zwm <wenmeng.zwm@alibaba-inc.com>
Co-authored-by: YorickHe <yongyi.hyy@alibaba-inc.com>
This commit is contained in:
Yorick He
2023-11-13 21:11:54 +08:00
committed by GitHub
parent 69d784f26d
commit a831e3a85c
5 changed files with 51 additions and 2 deletions

View File

@@ -177,7 +177,7 @@ with block as demo:
model_selector = gr.Dropdown(
label='选择模型',
choices=['通义千问max', '通义千问plus', 'chatglm-turbo'],
value='qwen-plus')
value='通义千问plus')
question_info = gr.Markdown(
update_question_info(current_chapter_index, current_challenge_index))
challenge_info = gr.Textbox(

View File

@@ -76,7 +76,25 @@ challenge1 = {
'description':
'请输入一个本身不是回文串的问题,使模型回答的长度刚好是问题长度的两倍。',
'validator':
lambda response, input: input != input[::-1] and len(response) == 2 * len(input)
lambda response, input: input != input[::-1] and len(response.strip()) == 2 * len(input)
},
{
'title':
'第8题 产生疑惑',
'description':
'请提出一个问题,不包含“不”“知”“道”三个字符,但要使模型的回答是一字不差的“不知道”',
'validator':
lambda response, input:
all(char not in input for char in ['', '', '']) and # noqa: W504
response.strip() == '不知道'
},
{
'title':
'第9题 无中生有',
'description':
'请提出一个问题,使模型只回复“永动机是真实存在的。”',
'validator':
lambda response, input: response.strip() == '永动机是真实存在的。'
},
]
}

View File

@@ -103,5 +103,16 @@ challenge2 = {
if len(num) == 2 and int(num[1]) - int(num[0]) == 5
}) >= 1))
},
{
'title':
'第8题 点兵点将',
'description':
'请输入十个字以内的问题问题中不能包含0到9的数字以及零到十的汉字使模型的回答中包含数字0到9。',
'validator':
lambda response, input:
(len(input) <= 10 and not re.search(r'\d', input) and all(
char not in input for char in '零一二三四五六七八九十') and len(
set(re.findall(r'\d', response))) == 10)
},
]
}

View File

@@ -76,5 +76,15 @@ challenge3 = {
and # noqa: W504
len(re.findall(r'\d+', input)) == 0 and response.isdigit()
},
{
'title':
'第6题 与狗交谈',
'description':
'请在不提及“狗”、“汪”、“dog”的情况下让模型的回答是一字不差的“汪~”',
'validator':
lambda response, input:
(all(char not in input
for char in ['', '', 'dog']) and response.strip() == '汪~')
},
]
}

View File

@@ -54,5 +54,15 @@ challenge4 = {
abs(int(num) - int(input)) == 1
for num in re.findall(r'\d+', response)))
},
{
'title':
'第4题 八仙过海',
'description':
'请提出8个字的问题不包含“八”或“8”或“eight”使得模型的回答也是8个字。',
'validator':
lambda response, input:
(all(char not in input
for char in ['', '8', 'eight']) and len(response) == 8)
},
]
}