_pickle.UnpicklingError: pickle data was truncated?

What is the mistake?I checked and found no path errors. How to modify it? Thank you!

for step, (testdata, testlabel) in enumerate(src_data_loader):
            
            testdata = make_variable(testdata)
            testlabel = make_variable(testlabel.squeeze_())


src_dataset = scipy.io.loadmat('E:\\ADDA\\adda-lab-mat\\datasets\\lab_mat\\test_target_domain_sandy')
testdata = src_dataset['testdata'] 
testlabel = src_dataset['testlabel'] 

testdata = torch.from_numpy(testdata).float()
testlabel = torch.from_numpy(testlabel).long() 

src_dataloader = torch.utils.data.DataLoader(
    dataset=src_dataset,
    batch_size=batch_size,
    shuffle=True,
    drop_last=True,
    num_workers=1)

return src_dataloader

Could you redownload or recreate the data as it seems the file is not complete (truncated).

Is there any other possible cause of the error? The error persists after I re-download the file.

Oh, it seems you are trying to pass a mat to the DataLoader.
Could you try to create a TensorDataset using the testdata and testlabels and pass this dataset to the DataLoader?

This time it works, thank you very much! Does the Dataloader have to load a dataset? What if I need to load testdata and testlabel separately?

DataLoader accepts Datasets and should also accept tensors.
However, I would recommend to wrap even tensors into a TensorDataset.
As long as your testdata and testlabel are tensors, it should be fine.

OK, thank you for your patience.