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: invalid literal for int() with base 10: '' #14

Open
sameer56 opened this issue Jan 6, 2020 · 5 comments
Open

ValueError: invalid literal for int() with base 10: '' #14

sameer56 opened this issue Jan 6, 2020 · 5 comments

Comments

@sameer56
Copy link

sameer56 commented Jan 6, 2020

Traceback (most recent call last):
File "test_panoptic.py", line 358, in
main(parser.parse_args())
File "test_panoptic.py", line 322, in main
Traceback (most recent call last):
File "test_panoptic.py", line 358, in
test_dataloader = make_dataloader(args, config, rank, world_size)
File "test_panoptic.py", line 80, in make_dataloader
test_sampler = DistributedARBatchSampler(test_db, config.getint("val_batch_size"), world_size, rank, False)
File "/usr/lib/python3.6/configparser.py", line 1283, in get
main(parser.parse_args())
File "test_panoptic.py", line 322, in main
test_dataloader = make_dataloader(args, config, rank, world_size)
File "test_panoptic.py", line 80, in make_dataloader
test_sampler = DistributedARBatchSampler(test_db, config.getint("val_batch_size"), world_size, rank, False)
File "/usr/lib/python3.6/configparser.py", line 1283, in get
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: ''
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: ''
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/torch/distributed/launch.py", line 246, in
main()
File "/usr/local/lib/python3.6/dist-packages/torch/distributed/launch.py", line 242, in main
cmd=cmd)
subprocess.CalledProcessError: Command '['/home/teai/Pramod/pramod_env/bin/python3', '-u', 'test_panoptic.py', '--local_rank=1', 'config=/home/teai/Pramod/Segmentation/seamseg/seamseg_r50_vistas/config.ini', 'model=/home/teai/Pramod/Segmentation/seamseg/seamseg_r50_vistas/seamseg_r50_vistas.tar', 'data=/home/teai/Pramod/Segmentation/seamseg/Input_dir/', 'out_dir=/home/teai/Pramod/Segmentation/seamseg/Output_dir']' returned non-zero exit status 1.

@ducksoup
Copy link
Contributor

ducksoup commented Jan 7, 2020

@sameer56 please check your configuration file, the val_batch_size parameter is probably empty.

@sameer56
Copy link
Author

sameer56 commented Jan 8, 2020

Hi,
Thanks for the previous response.As you mentioned train_batch_size and val_batch_size were null, I have set the value for train_batch_size and val_batch_size in the .ini file(config/defaults) as 2 & 1 respectively, but when I try to fetch the same value in code iam facing the same error.

@ducksoup
Copy link
Contributor

ducksoup commented Jan 10, 2020

@sameer56 As described here in the README, parameters are specified by providing a configuration file to the training scripts. The files in config/defaults just include the list of all available parameters with some meaningful default values, so you shouldn't modify those. Please try and follow the procedure described in the README, that should solve your issues.

@linehammer
Copy link

The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that's not an integer to the int() function . In other words it's either empty, or has a character in it other than a digit.

You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

if val.isdigit():

The other way to overcome this issue is to wrap your code inside a Python try...except block to handle this error.

Python2.x and Python3.x

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 .

With Python2.x , int(str(3/2)) gives you "1". With Python3.x , the same gives you ("1.5"): ValueError: invalid literal for int() with base 10: "1.5".

@flutterq
Copy link

All possible working solution added [Solved] ValueError: invalid literal for int() with base 10

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

4 participants