mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Dataset] add GLUE QQP dataset (#438)
This commit is contained in:
parent
d8354fe5d8
commit
14fdecfecc
4
configs/datasets/GLUE_QQP/GLUE_QQP_ppl.py
Normal file
4
configs/datasets/GLUE_QQP/GLUE_QQP_ppl.py
Normal file
@ -0,0 +1,4 @@
|
||||
from mmengine.config import read_base
|
||||
|
||||
with read_base():
|
||||
from .GLUE_QQP_ppl_250d00 import QQP_datasets # noqa: F401, F403
|
51
configs/datasets/GLUE_QQP/GLUE_QQP_ppl_250d00.py
Normal file
51
configs/datasets/GLUE_QQP/GLUE_QQP_ppl_250d00.py
Normal file
@ -0,0 +1,51 @@
|
||||
from opencompass.openicl.icl_prompt_template import PromptTemplate
|
||||
from opencompass.openicl.icl_retriever import FixKRetriever
|
||||
from opencompass.openicl.icl_inferencer import PPLInferencer
|
||||
from opencompass.openicl.icl_evaluator import AccEvaluator
|
||||
from opencompass.datasets import HFDataset
|
||||
|
||||
|
||||
_hint = "The following are semantic matching questions. \n" \
|
||||
"Please determine whether the following two sentences are semantically duplicate: " \
|
||||
"0 means not duplicate, 1 means duplicate.\n"
|
||||
QQP_infer_cfg = dict(
|
||||
ice_template=dict(
|
||||
type=PromptTemplate,
|
||||
template="Sentence one: {question1}\nSentence two: {question2}\nResult: {label}",
|
||||
),
|
||||
prompt_template=dict(
|
||||
type=PromptTemplate,
|
||||
template={
|
||||
answer:
|
||||
f"{_hint}</E>Sentence one: {{question1}}\nSentence two: {{question2}}\nResult: {answer}"
|
||||
for answer in [0, 1]
|
||||
},
|
||||
ice_token='</E>',
|
||||
),
|
||||
retriever=dict(type=FixKRetriever),
|
||||
inferencer=dict(type=PPLInferencer, fix_id_list=[0, 1, 2, 3, 4]))
|
||||
|
||||
QQP_eval_cfg = dict(evaluator=dict(type=AccEvaluator), )
|
||||
|
||||
|
||||
QQP_datasets = []
|
||||
for _split in ["validation", "test"]:
|
||||
|
||||
QQP_reader_cfg = dict(
|
||||
input_columns=['question1', 'question2'],
|
||||
output_column='label',
|
||||
train_split="train",
|
||||
test_split=_split
|
||||
)
|
||||
|
||||
QQP_datasets.append(
|
||||
dict(
|
||||
abbr=f'QQP-{_split}',
|
||||
type=HFDataset,
|
||||
path='glue',
|
||||
name='qqp',
|
||||
reader_cfg=QQP_reader_cfg,
|
||||
infer_cfg=QQP_infer_cfg,
|
||||
eval_cfg=QQP_eval_cfg
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user