Spaces:
Configuration error
Configuration error
Download ldm/data/dummy.py from Maximumm/zero123-live: direct link, hf CLI and curl.
- Browser
- Download file 887 Bytes
-
https://huggingface.co/spaces/Maximumm/zero123-live/resolve/main/ldm/data/dummy.py
- Command line
-
hf download hf://spaces/Maximumm/zero123-live/ldm/data/dummy.py
-
curl -L -o dummy.py https://huggingface.co/spaces/Maximumm/zero123-live/resolve/main/ldm/data/dummy.py
887 Bytes
| import numpy as np | |
| import random | |
| import string | |
| from torch.utils.data import Dataset, Subset | |
| class DummyData(Dataset): | |
| def __init__(self, length, size): | |
| self.length = length | |
| self.size = size | |
| def __len__(self): | |
| return self.length | |
| def __getitem__(self, i): | |
| x = np.random.randn(*self.size) | |
| letters = string.ascii_lowercase | |
| y = ''.join(random.choice(string.ascii_lowercase) for i in range(10)) | |
| return {"jpg": x, "txt": y} | |
| class DummyDataWithEmbeddings(Dataset): | |
| def __init__(self, length, size, emb_size): | |
| self.length = length | |
| self.size = size | |
| self.emb_size = emb_size | |
| def __len__(self): | |
| return self.length | |
| def __getitem__(self, i): | |
| x = np.random.randn(*self.size) | |
| y = np.random.randn(*self.emb_size).astype(np.float32) | |
| return {"jpg": x, "txt": y} | |