task_categories:text-classification size_categories:10K<n<100K language:en SFT region:us
---
dataset_info:
  features:
  - name: goal
    dtype: string
  - name: sol1
    dtype: string
  - name: sol2
    dtype: string
  - name: label
    dtype:
      class_label:
        names:
          '0': '0'
          '1': '1'
  splits:
  - name: train
    num_bytes: 4104002
    num_examples: 16113
  - name: validation
    num_bytes: 464309
    num_examples: 1838
  download_size: 0
  dataset_size: 4568311
task_categories:
- text-classification
language:
- en
tags:
- SFT
size_categories:
- 10K<n<100K
---
# Physical Interaction: Question Answering (PIQA)

- Source: https://huggingface.co/datasets/piqa
- Num examples: 
  - 16,113 (train)
  - 1,838 (validation)
- Language: English

```python
from datasets import load_dataset

load_dataset("vietgpt/piqa_en")
```

- Format for GPT-3

```python
def preprocess_gpt3(sample):
    goal = sample['goal']
    sol1 = sample['sol1']
    sol2 = sample['sol2']
    label = sample['label']

    if label == 0:
        output = f'\n<|correct|> {sol1}\n<|incorrect|> {sol2}'
    elif label == 1:
        output = f'\n<|correct|> {sol2}\n<|incorrect|> {sol1}'

    return {'text': f'<|startoftext|><|context|> {goal} <|answer|> {output} <|endoftext|>'}

"""
<|startoftext|><|context|> When boiling butter, when it's ready, you can <|answer|> 
<|correct|> Pour it into a jar
<|incorrect|> Pour it onto a plate <|endoftext|>
"""
```