list index out of range error when I execute a command with examples/run_glue.py
Author: HiroshigeAoki
Pull request: no

 Hi, I am new to transformers, and I got a list index out of range error when I execute a command for examples/run_glue.py. 
 I want to do Fine-Turning to classify Japanese words, and I modified some files following a web site. 

**The process was:**
**1. I used these commands below to install transformers and to use examples following github's instructions.**

```
$ pip install transformers
$ git clone https://github.com/huggingface/transformers
$ cd transformers
$ pip install .
$ pip install -r ./examples/requirements.txt
```

**2. I changed two files(transformers/data/processors/glue.py, transformers/data/metrics/__init__.py)** 
 I will show you them last of this question.

**3. I made train.tsv and dev.tsv under the data/original/ directory after making this directory.**
 I will show you them last of this question.

**4. I executed a command below.**

```
$ python ./examples/run_glue.py 
    --data_dir=./src/transformers/data/original/ 
    --model_type=bert 
    --model_name_or_path=bert-base-japanese-whole-word-masking 
    --task_name=original 
    --do_train 
    --do_eval 
    --output_dir=output/original

```

**5. list index out of range error occurred.**

```
Traceback (most recent call last):
  File "./examples/run_glue.py", line 562, in <module>
    main()
  File "./examples/run_glue.py", line 510, in main
    train_dataset = load_and_cache_examples(args, args.task_name, tokenizer, evaluate=False)
  File "./examples/run_glue.py", line 358, in load_and_cache_examples
    processor.get_dev_examples(args.data_dir) if evaluate else processor.get_train_examples(args.data_dir)
  File "/home/haoki/Bert1/lib/python3.6/site-packages/transformers/data/processors/glue.py", line 519, in get_train_examples
    return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
  File "/home/haoki/Bert1/lib/python3.6/site-packages/transformers/data/processors/glue.py", line 538, in _create_examples
    label = line[1]
IndexError: list index out of range

```

**My environment:**
OS: linux
IDE: pycharm
python: python 3.6 

I stacked almost for a day with problem... Pleeease help meeee.

--------------------------------------------------------------------------
**Codes of procedure 2 and 3:**
**transformers/data/processors/glue.py　(Transformers are installed with pip):**
```

~~~
#added this class
class OriginalProcessor(DataProcessor):
    """Processor for the original data set."""
    def get_example_from_tensor_dict(self, tensor_dict):
        """See base class."""
        return InputExample(
            tensor_dict["idx"].numpy(),
            tensor_dict["sentence"].numpy().decode("utf-8"),
            None,
            str(tensor_dict["label"].numpy()),
        )

    def get_train_examples(self, data_dir):
        """See base class."""
        return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")

    def get_dev_examples(self, data_dir):
        """See base class."""
        return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")

    def get_labels(self):
        """See base class."""
        return ["0", "1"]

    def _create_examples(self, lines, set_type):
        """Creates examples for the training and dev sets."""
        examples = []
        for (i, line) in enumerate(lines):
            # If TSV file has a header, it will take off it.
            # if i == 0:
            #     continue
            guid = "%s-%s" % (set_type, i)
            text_a = line[0]
            label = line[1]
            examples.append(InputExample(guid=guid, text_a=text_a, text_b=None, label=label))
        return examples

glue_tasks_num_labels = {
    "cola": 2,
    "mnli": 3,
    "mrpc": 2,
    "sst-2": 2,
    "sts-b": 1,
    "qqp": 2,
    "qnli": 2,
    "rte": 2,
    "wnli": 2,

    "original": 2, # added
}

glue_processors = {
    "cola": ColaProcessor,
    "mnli": MnliProcessor,
    "mnli-mm": MnliMismatchedProcessor,
    "mrpc": MrpcProcessor,
    "sst-2": Sst2Processor,
    "sts-b": StsbProcessor,
    "qqp": QqpProcessor,
    "qnli": QnliProcessor,
    "rte": RteProcessor,
    "wnli": WnliProcessor,

    "original": OriginalProcessor, # added
}

glue_output_modes = {
    "cola": "classification",
    "mnli": "classification",
    "mnli-mm": "classification",
    "mrpc": "classification",
    "sst-2": "classification",
    "sts-b": "regression",
    "qqp": "classification",
    "qnli": "classification",
    "rte": "classification",
    "wnli": "classification",

    "original": "classification", # added
}

```


**transformers/data/metrics/__init__.py (Transformers are installed with pip)**

```
    def glue_compute_metrics(task_name, preds, labels):
        assert len(preds) == len(labels)
        if task_name == "cola":
            return {"mcc": matthews_corrcoef(labels, preds)}
        elif task_name == "sst-2":
            return {"acc": simple_accuracy(preds, labels)}
        elif task_name == "mrpc":
            return acc_and_f1(preds, labels)
        elif task_name == "sts-b":
            return pearson_and_spearman(preds, labels)
        elif task_name == "qqp":
            return acc_and_f1(preds, labels)
        elif task_name == "mnli":
            return {"acc": simple_accuracy(preds, labels)}
        elif task_name == "mnli-mm":
            return {"acc": simple_accuracy(preds, labels)}
        elif task_name == "qnli":
            return {"acc": simple_accuracy(preds, labels)}
        elif task_name == "rte":
            return {"acc": simple_accuracy(preds, labels)}
        elif task_name == "wnli":
            return {"acc": simple_accuracy(preds, labels)}

        # added
        elif task_name == "original":
            return {"acc": simple_accuracy(preds, labels)}

        else:
            raise KeyError(task_name)

````


**train.tsv**
```

面白かった  0 #interesting
楽しかった  0 #fun
退屈だった  1 #boring
悲しかった  1 #sad
```

**dev.tsv**
```

満喫した  0 #satisfied
辛かった  1 #hard

````


Comments:
Hi, have you fixed this error? I just got the same error. Any help will be grateful!

Hi, I have already fixed it. I made a mistake on tsv files. After converting them to correct format by using LibreOffice, glue.py ran correctly. 
I hope this could help you!

Thanks! I fixed this error. There were some errors in my input file.