MMSD2.0 / README.md
coderchen01's picture
Update README.md
cc78864 verified
|
raw
history blame
1.64 kB
---
license: unknown
task_categories:
- feature-extraction
- text-classification
- image-classification
- image-feature-extraction
- zero-shot-classification
- zero-shot-image-classification
language:
- en
tags:
- sarcasm
- sarcasm-detection
- mulitmodal-sarcasm-detection
- sarcasm detection
- multimodao sarcasm detection
- tweets
pretty_name: mmsd_v2
size_categories:
- 10K<n<100K
---
# MMSD2.0: Towards a Reliable Multi-modal Sarcasm Detection System
This is a copy of the dataset uploaded on Hugging Face for easy access. The original data comes from this [work](https://aclanthology.org/2023.findings-acl.689/).
## Usage
```python
# usage
from datasets import load_dataset
from transformers import CLIPImageProcessor, CLIPTokenizer
from torch.utils.data import DataLoader
image_processor = CLIPImageProcessor.from_pretrained(clip_path)
tokenizer = CLIPTokenizer.from_pretrained(clip_path)
def tokenization(example):
text_inputs = tokenizer(example["text"], truncation=True, padding=True, return_tensors="pt")
image_inputs = image_processor(example["image"], return_tensors="pt")
return {'pixel_values': image_inputs['pixel_values'],
'input_ids': text_inputs['input_ids'],
'attention_mask': text_inputs['attention_mask'],
"label": example["label"]}
dataset = load_dataset('quaeast/multimodal_sarcasm_detection')
dataset.set_transform(tokenization)
# get torch dataloader
train_dl = DataLoader(dataset['train'], batch_size=256, shuffle=True)
test_dl = DataLoader(dataset['test'], batch_size=256, shuffle=True)
val_dl = DataLoader(dataset['validation'], batch_size=256, shuffle=True)
```