Custom Datablock-Transforms

Hi everyone, I’m trying to solve an audio classification problem with fastai, but I can’t figure out the right syntax to integrate torchaudio into the pipeline. Right now I’m using a DataBlock like this:

    datablock = DataBlock(blocks=(AudioBlock(), CategoryBlock),

Now my question is: What do I have to pass to item_tfms in order create my spectrograms? I’ve tried the following:

item_tfms =[ItemTransform(torchaudio.transforms.MelSpectrogram())]

but it gives me back ‘AttributeError: ‘list’ object has no attribute ‘size’’ when it tries to create the spectrogram. I don’t understand it, because AudioBlock should create a tensor, not a list. When I do it without the ItemTransform wrapper it also doesn’t work, but this time it’s ‘IndexError: tuple index out of range’.

It worked before with fastaudio, but as the library is not compatible with the latest versions of fastai I want to switch to torchaudio instead. I am fairly new to Machine Learning and programming in general, so any help is appreciated :slightly_smiling_face: