Strange exception
# ❓ Questions & Help


Hi everybody, 
I'm keeping experiment with the following colab: 
https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=X9_Go99fvW-z

however I got a new error after the fine-tuning starts:

Exception in thread Thread-20:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/torch_xla/distributed/parallel_loader.py", line 141, in _loader_worker
    _, data = next(data_iter)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 354, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 394, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "<ipython-input-6-cc30f67d4a07>", line 34, in collate_batch
    input_ids = torch.stack([example['input_ids'] for example in batch])
  File "<ipython-input-6-cc30f67d4a07>", line 34, in <listcomp>
    input_ids = torch.stack([example['input_ids'] for example in batch])
TypeError: string indices must be integers

Is this due to the new changes introduced yesterday for the DataCollate ?


The notebook is not using the collation function from `transformers` but the `T2TDataCollator` it defines. Apart from stopping subclassing `DataCollator` (as it's not a class anymore on master) this shouldn't be a problem.<|||||>Hi, @antoniomastro1996 , if you are using transformers from master branch then there are few changes.
As @sgugger  said, `DataCollator` is not a class anymore, so just don't subclass. Also as datacollator is now a `callable`, rename the `batch_collate` method to  `__call__`.

Or you can use version 2.11.0 and it'll work as it is. I'll update the notebook once the new version is released. Let me know if you run into any other issues.<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
