Error Training T5 Transformer Translation Model
Author: jameschartouni
Pull request: no

# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. Make sure to tag your question with the
     right deep learning framework as well as the huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     
     If your question wasn't answered after a period of time on Stack Overflow, you
     can always open a question on GitHub. You should then link to the SO question 
     that you posted.
     -->

## Details
We are trying to train a T5 model to translate between English, Modern Standard Arabic, Levantine Arabic and Maghrebi Arabic. We are using Tensorflow to process the code as well as the default Sentence Piece tokenizer and custom Sentence Piece Tokenizer both set to the default Vocab size of 32,128. Below is the hyper parameters we used for training the model and one of the languages T5 Data Task Registry. 


```
t5.data.TaskRegistry.remove("mag_msa_translation")
t5.data.TaskRegistry.add(
    #name of the Task
    "mag_msa_translation",
    #Supply a function which returns a tf.data.Dataset
    dataset_fn=mag_msa_translation_dataset_fn,
    splits=["train", "validation"],
    # Supply a function which preprocesses text from the tf.data.Dataset.
    text_preprocessor=[mag_msa_translation_preprocessor],
    # Use the same vocabulary that we used for pre-training.
    sentencepiece_model_path=filepath, #str(multibpemb.model_file), #t5.data.DEFAULT_SPM_PATH
    # Lowercase targets before computing metrics.
    postprocess_fn = t5.data.postprocessors.lower_text, 
    # We'll use accuracy as our evaluation metric.
    metric_fns=[t5.evaluation.metrics.accuracy],
    # Not required, but helps for mixing and auto-caching.
    #num_input_examples=num_nq_examples
)
```



```
STEPS = 1000 #@param {type: "integer"}
model.train(
    mixture_or_task_name="ar_translation",
    steps=STEPS,
    save_steps=100,
    sequence_length={"inputs": 128, "targets": 128'},#128
    split="train",
    batch_size=32, #32
    optimizer=functools.partial(transformers.AdamW, lr=1e-4),
)
```


Why are we receiving the error posted below?

![image](https://user-images.githubusercontent.com/16104649/81619673-1c858780-93b8-11ea-8706-54e1db3895f5.png)

Please let me know if you need to see more code or have any additional clarifying questions. Thank you in advance! 

<!-- You should first ask your question on SO, and only if
     you didn't get an answer ask it here on GitHub. -->
**A link to original question on Stack Overflow**:


Comments:
Which library are you using? Could you maybe post a complete code example (with all relevant imports) to reproduce the error? 

https://github.com/jameschartouni/arabic_translation/blob/google-t5/Model_1.ipynb

Let me know if you have difficulty viewing the code! We are using colab and use a fresh install. 

I see you use the official T5 code that connects to HF code. The error seems to be happening in the `t5` library though (in `t5/models/hf_model.py`). Could you open an issue there? We haven't written the code so it's very hard for us to debug this.