Spaces:
Sleeping
Sleeping
Download data/__init__.py from JVishu/DeepTracer_Audio: direct link, hf CLI and curl.
- Browser
- Download file 617 Bytes
-
https://huggingface.co/spaces/JVishu/DeepTracer_Audio/resolve/main/data/__init__.py
- Command line
-
hf download hf://spaces/JVishu/DeepTracer_Audio/data/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/JVishu/DeepTracer_Audio/resolve/main/data/__init__.py
617 Bytes
| import torch.utils.data | |
| class DataProvider(): | |
| def __init__(self, cfg, dataset, batch_size=None, shuffle=True): | |
| super().__init__() | |
| self.dataset = dataset | |
| if batch_size is None: | |
| batch_size = cfg.BATCH_SIZE | |
| self.dataloader = torch.utils.data.DataLoader( | |
| self.dataset, | |
| batch_size=batch_size, | |
| shuffle=shuffle, | |
| num_workers=int(cfg.WORKERS), | |
| drop_last=False) | |
| def __len__(self): | |
| return len(self.dataset) | |
| def __iter__(self): | |
| for i, data in enumerate(self.dataloader): | |
| yield data |