Adapters
English
code
medical
dnnsdunca commited on
Commit
27c649c
1 Parent(s): 455a50b

Create Data_loader.py

Browse files
Files changed (1) hide show
  1. Data_loader.py +20 -0
Data_loader.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # utils/data_loader.py
2
+ import torch
3
+ from torch.utils.data import Dataset, DataLoader
4
+
5
+ class CustomDataset(Dataset):
6
+ def __init__(self, data):
7
+ self.data = data
8
+
9
+ def __len__(self):
10
+ return len(self.data)
11
+
12
+ def __getitem__(self, idx):
13
+ return self.data[idx]
14
+
15
+ def load_data(batch_size=32):
16
+ # Dummy data
17
+ data = [torch.randn(10) for _ in range(1000)]
18
+ dataset = CustomDataset(data)
19
+ loader = DataLoader(dataset, batch_size=batch_size, shuffle=True)
20
+ return loader