Dl=data[1] vs dl=data.valid

Hi,

I have trained a model using fastai and am trying to test it using the following command:

preds1, y1 = learn.get_preds(dl=data[1]), where data is the dataloader object. It worked and I can get the predictions. However, the following command gives different predictions

preds2, y2 = learn.get_preds(dl=data.valid).

What is the difference between data[1] and data.valid?

Thank you for your time,
Best regards

There shouldn’t be, as learn.dls[1] and learn.dls.valid are the same thing. How are you creating data?

Thank you for your reply. I am loading the data from a pandas dataframe:

auds = DataBlock(blocks = (AudioBlock(crop_signal_to=args.seconds*1000), CategoryBlock),
get_x = ColReader(“FilePath”),
get_y = ColReader(“ClassID”),
splitter = IndexSplitter(df[df.DB == ‘Set1’].index),
item_tfms = item_tfms,
)

data = auds.dataloaders(df, bs=args.batch_size, shuffle=False)