I'am using someone else's deep learning network to train my dataset, but I'm running into problems I can't solve

Jacky1: <p><strong>origal dataset is CWRU, I change it by my datasets, but  I’m running into problems I can’t solve.</strong></p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "E:/pythonProject/DAGCN-main/DAGCN/train_advanced.py", line 103, in &lt;module&gt;
    trainer.train()
  File "E:\pythonProject\DAGCN-main\DAGCN\utils\train_utils_combines.py", line 217, in train
    for batch_idx, (inputs, labels) in enumerate(self.dataloaders[phase]):
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 681, in __next__
    data = self._next_data()
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 721, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in fetch
    return self.collate_fn(data)
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 175, in default_collate
    return [default_collate(samples) for samples in transposed]  # Backwards compatibility.
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 175, in &lt;listcomp&gt;
    return [default_collate(samples) for samples in transposed]  # Backwards compatibility.
  File "C:\Users\kitty\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 183, in default_collate
    raise TypeError(default_collate_err_msg_format.format(elem_type))
TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found &lt;class 'pandas.core.series.Series'&gt;
</code></pre>
<p><strong>Here is the part dataset code I wrote myself</strong></p>
<blockquote>
<p>def data_load(filename, axisname, label):<br>
fl = pd.read_excel(filename, column_index=axis[5])<br>
data = <span class="chcklst-box fa fa-square-o fa-fw"></span><br>
lab = <span class="chcklst-box fa fa-square-o fa-fw"></span><br>
start, end = 0, signal_size<br>
while end &lt;= fl.shape[0]:<br>
data.append(fl[start:end])<br>
lab.append(label)<br>
start += signal_size<br>
end += signal_size<br>
return data, lab<br>
<strong>When I tried to ask Chatgpt to solve this problem, the method it told me didn’t solve my problem.</strong><br>
import pandas as pd<br>
import numpy as np<br>
import torch<br>
data = pd.read_csv(‘data.csv’)<br>
data_np = np.array(data)   # for numpy array<br>
data_tensor = torch.tensor(data_np)   # for PyTorch tensor<br>
dataset = torch.utils.data.TensorDataset(data_tensor)<br>
dataloader = torch.utils.data.DataLoader(dataset, batch_size=32)</p>
</blockquote>

ptrblck: <p>Based on the error message:</p>
<pre><code class="lang-python">TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found &lt;class 'pandas.core.series.Series'&gt;
</code></pre>
<p>you are passing a <code>pandas.Series</code> to the <code>DataLoader</code> which seems to cause the error.<br>
Do you have the source code of the dataset and could post it here as transforming the <code>pandas</code> object to a tensor should solve the issue.</p>