Skip to content

support more vision dataset #4132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions swift/llm/dataset/dataset/mllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,14 @@ def preprocess(self, row: Dict[str, Any]) -> Dict[str, Any]:
preprocess_func=ScienceQAPreprocessor(),
tags=['multi-modal', 'science', 'vqa', 'quality']))

register_dataset(
DatasetMeta(
ms_dataset_id='lmms-lab/ScienceQA-IMG',
hf_dataset_id='lmms-lab/ScienceQA-IMG',
split=['train', 'validation'],
preprocess_func=ScienceQAPreprocessor(),
tags=['multi-modal', 'science', 'vqa', 'quality']))


class GritPreprocessor(RowPreprocessor, GroundingMixin):

Expand Down Expand Up @@ -1213,3 +1221,21 @@ def preprocess(self, row: Dict[str, Any]) -> Dict[str, Any]:
hf_dataset_id='leonardPKU/clevr_cogen_a_train',
preprocess_func=ClevrPreprocessor(),
tags=['qa', 'math', 'vision', 'grpo']))


class OpenVLPreprocessor(ResponsePreprocessor):

def preprocess(self, row: Dict[str, Any]) -> Dict[str, Any]:
row['query'] = 'What is the caption of this image?'
return super().preprocess(row)


register_dataset(
DatasetMeta(
ms_dataset_id='swift/Open-Qwen2VL-Data',
hf_dataset_id='weizhiwang/Open-Qwen2VL-Data',
preprocess_func=OpenVLPreprocessor(columns={
'caption': 'response',
'url': 'images'
}),
tags=['caption', 'pretrain', 'vision']))
Loading