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

imbalanced data set not reading in correctly to torch #10

Open
jbh1128d1 opened this issue Nov 17, 2019 · 0 comments
Open

imbalanced data set not reading in correctly to torch #10

jbh1128d1 opened this issue Nov 17, 2019 · 0 comments

Comments

@jbh1128d1
Copy link

Hello,

I'm getting the following error trying to use the Imbalanced data sampler.


ValueError Traceback (most recent call last)
in
----> 1 train_loader = DataLoader(roof, batch_size=10, sampler = ImbalancedDatasetSampler)

C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in init(self, dataset, batch_size, shuffle, sampler, batch_sampler, num_workers, collate_fn, pin_memory, drop_last, timeout, worker_init_fn, multiprocessing_context)
217 if batch_size is not None and batch_sampler is None:
218 # auto_collation without custom batch_sampler
--> 219 batch_sampler = BatchSampler(sampler, batch_size, drop_last)
220
221 self.batch_size = batch_size

C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\sampler.py in init(self, sampler, batch_size, drop_last)
184 raise ValueError("sampler should be an instance of "
185 "torch.utils.data.Sampler, but got sampler={}"
--> 186 .format(sampler))
187 if not isinstance(batch_size, _int_classes) or isinstance(batch_size, bool) or
188 batch_size <= 0:

ValueError: sampler should be an instance of torch.utils.data.Sampler, but got sampler=<class 'sampler.ImbalancedDatasetSampler'>

Was I supposed to save the sampler.py file in a special location? I saved it in my directory and it imports.

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

1 participant