Colab can't import trim_batch for T5, anything changed in transformers.tokenization_utils?
from transformers.tokenization_utils import trim_batch

ImportError: cannot import name 'trim_batch'

Any solutions? Thanks a lot.
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.
<|||||>Had the same issue. Found a trim_batch implementation on the transformers repo, used it, didn't face any issues so far.

[Link to implementation](https://github.com/huggingface/transformers/blob/783d7d2629e97c5f0c5f9ef01b8c66410275c204/examples/research_projects/rag/utils_rag.py#L35)

Code for reference:

```python
def trim_batch(
    input_ids,
    pad_token_id,
    attention_mask=None,
):
    """Remove columns that are populated exclusively by pad_token_id"""
    keep_column_mask = input_ids.ne(pad_token_id).any(dim=0)
    if attention_mask is None:
        return input_ids[:, keep_column_mask]
    else:
        return (input_ids[:, keep_column_mask], attention_mask[:, keep_column_mask])
```