question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: num_samples should be a positive integer value, but got num_samples=0

See original GitHub issue

I am getting the ValueError: num_samples should be a positive integer value, but got num_samples=0 while running demo.sh

Traceback (most recent call last): File "main.py", line 33, in <module> main() File "main.py", line 22, in main loader = data.Data(args) File "/mnt/Study_Storage/Documents/Study/Projects/Stonybrook_Multimedia_AI/SuperResolution/EDSR-PyTorch/src/data/__init__.py", line 31, in __init__ num_workers=args.n_threads, File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 213, in __init__ sampler = RandomSampler(dataset) File "/home/rohit/anaconda3/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 94, in __init__ "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:13

github_iconTop GitHub Comments

4reactions
Vahe987commented, Jul 29, 2020

I have the same error, when I want to train it, but I see some people are trying to just test, that one works for me. The thing is, that in the demo.sh file un-commented line is the first command, which is right, put a # and comment that out. The line you are looking for is down in the file

#Test your own images #python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results

un-comment that command or simply run it in the terminal (without demo.sh)

1reaction
LiuDHScommented, Apr 2, 2020

I got the same error with you. Just check your dataset dir. For example, your dataset dir is ‘/dataset/DIV2K’, then you should set the parameter ‘–dir_data’ with ‘/dataset’.

Read more comments on GitHub >

github_iconTop Results From Across the Web

num_samples should be a positive integer value, but got ...
Hi, I checked the input data path and it was correct. But still i'm getting "ValueError: num_samples should be a positive integer value,...
Read more >
Num_samples should be a positive integer ... - PyTorch Forums
Hello everybody, I am new to PyTorch. I have a problem when I tried to train my data. When I run my program...
Read more >
ValueError: num_samples should be a positive integer value ...
I have the error of the title ValueError: num_samples should be a positive integer value, but got num_samples=0 because basically I am ...
Read more >
num_samples should be a positive integeral value, but got ...
Has anyone encountered and solved the below error: Error: ValueError: num_samples should be a positive integeral value, but got num_samples= ...
Read more >
num_samples should be a positive integer value ... - Medium
iam getting this error while executing this code. “num_samples should be a positive integer value, but got num_samples=0” is published by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found