Is it possible to get the training set confusion matrix for a text classifier in fastai2?

Hi,
I’m migrating my code from fastai1 and there it was easy to get the confusion matrix through TextClassificationInterpretation. However, in fastai2, there is no specific TextClassificationInterpretation and if I try something similar with just ClassificationInterpretation, like this:

interpreter = ClassificationInterpretation.from_learner(self._classifier, ds_idx=1)
interpreter.confusion_matrix()

I get this error:

    interpreter = ClassificationInterpretation.from_learner(self._classifier, ds_idx=0)
  File "/usr/local/lib/python3.8/site-packages/fastai/interpret.py", line 29, in from_learner
    return cls(dl, *learn.get_preds(dl=dl, with_input=True, with_loss=True, with_decoded=True, act=None))
  File "/usr/local/lib/python3.8/site-packages/fastai/learner.py", line 260, in get_preds
    if reorder and hasattr(dl, 'get_idxs'): res = nested_reorder(res, tensor(idxs).argsort())
  File "/usr/local/lib/python3.8/site-packages/fastai/torch_core.py", line 135, in tensor
    else _array2tensor(array(x), **kwargs))
  File "/usr/local/lib/python3.8/site-packages/fastai/torch_core.py", line 121, in _array2tensor
    return torch.from_numpy(x)
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

My input dataframe looks like this:

phrase           object
intent           object
is_validation     int64
dtype: object

How can I make it work?

On further testing, this actually only happens with the training set ( ds_idx=0). With the validation set ( ds_idx=1), it actually works. I don’t see why there is such a difference between the two cases.

So after a bit of digging, I think I’ve found a bug and opened the related issue here in case anyone is interested: Interpretation for text classifier doesn't work with training set because of wrong type for dataloader idx's · Issue #3556 · fastai/fastai · GitHub