anli_r3_en / README.md
hieunguyen1053's picture
Update README.md
f632b52
|
raw
history blame
2.62 kB
metadata
dataset_info:
  features:
    - name: uid
      dtype: string
    - name: premise
      dtype: string
    - name: hypothesis
      dtype: string
    - name: label
      dtype:
        class_label:
          names:
            '0': entailment
            '1': neutral
            '2': contradiction
    - name: reason
      dtype: string
  splits:
    - name: train
      num_bytes: 44720719
      num_examples: 100459
    - name: validation
      num_bytes: 663148
      num_examples: 1200
    - name: test
      num_bytes: 657586
      num_examples: 1200
  download_size: 15202058
  dataset_size: 46041453

The Adversarial Natural Language Inference (ANLI)

from datasets import load_dataset

load_dataset("vietgpt/anli_r3_en")
  • Format for NLI task
def preprocess(sample):
    premise = sample['premise']
    hypothesis = sample['hypothesis']
    label = sample['label']

    if label == 0:
        label = "entailment"
    elif label == 1:
        label = "neutral"
    else:
        label = "contradiction"
    return {'text': f'<|startoftext|><|premise|> {premise} <|hypothesis|> {hypothesis} <|label|> {label} <|endoftext|>'}

"""
<|startoftext|><|premise|> TOKYO, Dec 18 (Reuters) - Japan’s Shionogi & Co said on Tuesday that it has applied to health regulators in the United States, Canada and Europe for approval of its HIV drug Dolutegravir. Shionogi developed Dolutegravir with a Viiv Healthcare, an AIDS drug joint venture between GlaxoSmithKline and Pfizer, in exchange for its rights to the drug. <|hypothesis|> The article was written on December 18th. <|label|> entailment <|endoftext|>
"""
  • Format for Rationale task
def preprocess(sample):
    premise = sample['premise']
    hypothesis = sample['hypothesis']
    rationale = sample['reason']

    return {'text': f'<|startoftext|><|premise|> {premise} <|hypothesis|> {hypothesis} <|rationale|> {rationale} <|endoftext|>'}

"""
<|startoftext|><|premise|> TOKYO, Dec 18 (Reuters) - Japan’s Shionogi & Co said on Tuesday that it has applied to health regulators in the United States, Canada and Europe for approval of its HIV drug Dolutegravir. Shionogi developed Dolutegravir with a Viiv Healthcare, an AIDS drug joint venture between GlaxoSmithKline and Pfizer, in exchange for its rights to the drug. <|hypothesis|> The article was written on December 18th. <|rationale|> TOKYO, Dec 18 (Reuters) is when the article was written as it states in the first words of the sentence <|endoftext|>
"""