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

ValueError: sampler should be an instance of torch.utils.data.Sampler, but got sampler= #1

Open
deepdarkfans opened this issue Aug 14, 2022 · 0 comments

Comments

@deepdarkfans
Copy link

how do I solve this issue?

PS G:\Code\python\feddst-main> python dst.py --dataset cifar100 --sparsity 0.8 --readjustment-ratio 0.01 --rounds-between-readjustments 15
d:\aconda\lib\site-packages\numpy\_distributor_init.py:32: UserWarning: loaded more than 1 DLL from .libs:
d:\aconda\lib\site-packages\numpy\.libs\libopenblas.NOIJJG62EMASZI6NYURL6JBKM4EVBGM7.gfortran-win_amd64.dll
d:\aconda\lib\site-packages\numpy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
  stacklevel=1)
Fetching dataset...
Files already downloaded and verified
Files already downloaded and verified
Traceback (most recent call last):
  File "dst.py", line 156, in <module>
    min_samples=args.min_samples, samples=args.samples_per_client)
  File "G:\Code\python\feddst-main\datasets.py", line 260, in get_dataset
    loaders = DATASET_LOADERS[dataset](**kwargs)
  File "G:\Code\python\feddst-main\datasets.py", line 187, in get_cifar100
    return get_mnist_or_cifar10('cifar100', *args, **kwargs)
  File "G:\Code\python\feddst-main\datasets.py", line 170, in get_mnist_or_cifar10
    sampler=train_sampler)
  File "d:\aconda\lib\site-packages\torch\utils\data\dataloader.py", line 219, in __init__
    batch_sampler = BatchSampler(sampler, batch_size, drop_last)
  File "d:\aconda\lib\site-packages\torch\utils\data\sampler.py", line 186, in __init__
    .format(sampler))
ValueError: sampler should be an instance of torch.utils.data.Sampler, but got sampler=[22698 33390  4446 33283 45771 42299 21185 10162 45141 14705 31653 13757     
 48899 48083 19944 16561  3325 12918 14508  7476 38872 30302 30488 18939
 44300 39420 45427 36900 15161 11603 40117 37450 46114 16522 36011     5
 33643 35712  2899 49841 42602  7778 21439 13830 47418 11768 47719 22901
 22770 42600 32912 23262 16487 44006 14852 37454 30319  3642 22366 19071
 16431 20594 26033 18787 42249 23256 31776 14303 19008 45187 12456 16347
 44903 23723  9382 41662 28269  9748  6430 36681 44404  6414  9492 35776
 25226 15856 41338 13786 47888 48780 35629 10097 14327 41396 43233 14005
 16429 23779 48810    24 14457 43244 35796  8612 44231  5957 10090 11346
 43742 32739]
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