MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / dummy_dataloader_for_debug

Function dummy_dataloader_for_debug

trainer/__init__.py:10–44  ·  view source on GitHub ↗
(batch_size: int = 4, num_workers: int = 4)

Source from the content-addressed store, hash-verified

8
9
10def dummy_dataloader_for_debug(batch_size: int = 4, num_workers: int = 4):
11 import torch
12 from torch.utils.data import DataLoader, Dataset
13
14 class DummyDataset(Dataset):
15
16 def __init__(self) -> None:
17 super().__init__()
18 data = torch.randn(
19 1,
20 3,
21 1024,
22 1024,
23 )
24 self.data = data.expand(100000, -1, -1, -1)
25
26 def __len__(self, ):
27 return len(self.data)
28
29 def __getitem__(self, index):
30 return (
31 self.data[index],
32 self.data[index],
33 'A cat holding a sign that says hello world',
34 )
35
36 dataset = DummyDataset()
37 train_loader = DataLoader(
38 dataset,
39 batch_size,
40 shuffle=True,
41 num_workers=num_workers,
42 drop_last=True)
43 val_loader = train_loader
44 return train_loader, val_loader
45
46
47__all__ = [

Callers

nothing calls this directly

Calls 1

DummyDatasetClass · 0.85

Tested by

no test coverage detected