The tftrainer custom_datasets colab does not work with t5model
Author: kovkev
Pull request: no

## Environment info

- `transformers` version: 4.11.3
- Platform: Linux-5.4.104+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.12
- PyTorch version (GPU?): 1.9.0+cu111 (True)
- Tensorflow version (GPU?): 2.6.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: Parallel



### Who can help

Models:

- encoder-decoder models (For example, BlenderBot, BART, Marian, Pegasus, T5, ByT5): @patrickvonplaten, @patil-suraj

Library:

- Trainer: @sgugger

- maintained examples (not research project or legacy): @sgugger, @patil-suraj

## Information

https://colab.research.google.com/github/huggingface/notebooks/blob/master/transformers_doc/tensorflow/custom_datasets.ipynb

I added the following to produce decoder_input_ids:

```
train_labels = tokenizer(_train_labels, truncation=True, padding=True).input_ids
val_labels = tokenizer(_val_labels, truncation=True, padding=True).input_ids
test_labels = tokenizer(_test_labels, truncation=True, padding=True).input_ids
```

And construct the dataset with that. And, the model is TFT5

```
model = TFT5ForConditionalGeneration.from_pretrained('t5-small')
```

I get

```
----> 7 model.fit(train_dataset.shuffle(1000).batch(16), epochs=3, batch_size=16)

stack

    /usr/local/lib/python3.7/dist-packages/transformers/models/t5/modeling_tf_t5.py:637 call  *
        raise ValueError(f"You have to specify either {err_msg_prefix}input_ids or {err_msg_prefix}inputs_embeds")
```

I'm sorry if I provide not enough information. I try to be succinct. Essentially, it is not clear from the docs or trainer colab how to pass the decoder_input_ids. It seems to me like I am setting it in the dataset, because I redefined {train,val,test}_labels.


Comments:
When building the dataset, I tried doing `train_encodings["labels"] = train_labels.input_ids`, but now I get a new error when calling `.fit()`: 

```
    /usr/local/lib/python3.7/dist-packages/transformers/modeling_tf_utils.py:165 compute_loss  *
        reduced_logits = tf.boolean_mask(tf.reshape(logits, (-1, shape_list(logits)[2])), active_loss)

    IndexError: list index out of range
```

I'm not sure which task you are interested in, but since T5 is for sequence-to-sequence problems and there is none of that in this tutorial, you should check the [example notebook](https://huggingface.co/transformers/master/notebooks.html#tensorflow-examples) corresponding to your task.

The labels in this custom_datasets colab were 0 or 1. What if we simply change the labels to "neg" and "pos" (I read/understood that in T5, strings like that are valid classes, is that correct?)

Thank you! I'll check out the link you share

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.