-
Notifications
You must be signed in to change notification settings - Fork 15
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
ValueError: sampler should be an instance of torch.utils.data.Sampler, #3
Comments
Could you try to modify:
to read instead:
? Please let me know if it works and don't hesitate to send a PR. |
I get this error now Traceback (most recent call last): I know it's just a missing parameter but I don't understand what's happening in this piece of code, so please help! :D |
Just checking, are you using |
It gives me the same error in both cases |
Sorry @bbrattoli, don't have time to look at this in detail these days. I'll update here if I check what's going on. Meanwhile, the way to go is to define yourself a |
Dear vadimkantorov,
thank you for your publishing this nice repo, very well written.
I'm running
"python train.py --dataset cub2011 --model margin --base resnet50"
with pytorch 1.0.1 and pythorn 3.6 but it crushes with the error
Traceback (most recent call last):
File "train.py", line 71, in
loader_train = torch.utils.data.DataLoader(dataset_train, sampler = adapt_sampler(opts.batch, dataset_train, opts.sampler), num_workers = opts.threads, batch_size = opts.batch, drop_last = True, pin_memory = True)
File "/export/home/bbrattol/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 805, in init
batch_sampler = BatchSampler(sampler, batch_size, drop_last)
File "/export/home/bbrattol/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 146, in init
.format(sampler))
ValueError: sampler should be an instance of torch.utils.data.Sampler, but got sampler=<main. object at 0x7f199b08a9b0>
I guess it has something to do with the new pytorch version. Could you help me to make it run correctly?
Thanks
The text was updated successfully, but these errors were encountered: