Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: (<function SafeDataset.__getitem__ at 0x0000025B61310B70>, (1527,), frozenset()) #20

Open
Baldins opened this issue Sep 14, 2019 · 3 comments

Comments

@Baldins
Copy link

Baldins commented Sep 14, 2019

I am getting the following error:

"KeyError: (<function SafeDataset.getitem at 0x0000025B61310B70>, (1527,), frozenset())"

Do you have any idea of why is this happening?

Thanks in advance for the help!

@msamogh
Copy link
Owner

msamogh commented Sep 14, 2019

Are you using SafeDataLoader or DataLoader? You need to use SafeDataLoader.

@Baldins
Copy link
Author

Baldins commented Sep 14, 2019

DataLoader - but it wasn't giving me error before.
Also, if I use SafeDataLoader and I run next(iter(dataloader)) it returns []. So, it seems like it is empty. But I don't get why it is happening.

@Baldins
Copy link
Author

Baldins commented Sep 14, 2019

This is the code:

batch_size = 32
validation_split = .2
shuffle_dataset = False
random_seed= 42

dataset_size = len(dataset_s)
indices = list(range(dataset_size))

split = 480
if shuffle_dataset :
np.random.seed(random_seed)
np.random.shuffle(indices)
train_indices, val_indices = indices[:-split], indices[-split:12032]

train_sampler = SubsetRandomSampler(train_indices)
valid_sampler = SubsetRandomSampler(val_indices)

train_loader = nc.SafeDataLoader(dataset, batch_size=batch_size,
sampler=train_sampler, num_workers=0)
validation_loader = nc.SafeDataLoader(dataset, batch_size=batch_size,
sampler=valid_sampler, num_workers=0)

In [24]:
next(iter(train_loader))

Out[24]:
[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants