mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 20:19:51 +01:00
format code
This commit is contained in:
@@ -9,7 +9,7 @@ def validate_palindrome_invariance(origin_input, response, generate_response):
|
||||
# 检查原始输入不是回文
|
||||
if origin_input == origin_input[::-1]:
|
||||
return False
|
||||
|
||||
|
||||
# 将原始问题倒序并提交
|
||||
reversed_question = origin_input[::-1]
|
||||
reversed_response = generate_response(reversed_question)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
|
||||
|
||||
def validate_palindrome_inverse(origin_input, response, generate_response):
|
||||
"""
|
||||
验证器函数,检查对于给定的问题,正着问和倒着问的模型的回答本身不回文且也是逆序的关系。
|
||||
@@ -71,7 +72,9 @@ challenge3 = {
|
||||
'description':
|
||||
'请输入一个以“为什么”开头,以“?”结尾的不包含数字的问题,使回答中只包含数字。',
|
||||
'validator':
|
||||
lambda response, input: '为什么' == input[:3] and "?" == input[-1] and len(re.findall(r'\d+', input)) == 0 and response.isdigit()
|
||||
lambda response, input: '为什么' == input[:3] and '?' == input[-1]
|
||||
and # noqa: W504
|
||||
len(re.findall(r'\d+', input)) == 0 and response.isdigit()
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
|
||||
|
||||
def validate_reciprocal_question(input, response, generate_response):
|
||||
"""
|
||||
验证器函数,检查给定的问题A和回答B,是否能够通过以B作为新的提问得到原始问题A作为回答。
|
||||
|
||||
Reference in New Issue
Block a user