sg-nm / cgp-cnn-PyTorch

A Genetic Programming Approach to Designing CNN Architectures, In GECCO 2017 (oral presentation, Best Paper Award)
MIT License
46 stars 24 forks source link

RuntimeError: Expected a_in <= b_in to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) #4

Open yuxiaomu opened 4 years ago

yuxiaomu commented 4 years ago

/opt/anaconda/bin/python /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/exp_main.py gpu_id: 0 , [['input', 0, 0], ['S_ResBlock_128_1', 0, 0], ['S_ResBlock_64_5', 1, 1], ['S_ResBlock_32_3', 2, 1], ['S_ConvBlock_128_3', 3, 1], ['S_ConvBlock_32_1', 4, 4], ['S_ResBlock_32_5', 5, 4], ['S_ResBlock_128_3', 6, 5], ['full', 7, 7]] Files already downloaded and verified Files already downloaded and verified train num 50000 GPUID : 0 epoch_num : 50 batch_size: 128 /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py:67: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. init.kaiming_normal(m.weight.data, a=0, mode='fan_in') /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnntrain.py:71: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform. init.uniform(m.weight.data, 1.0, 0.02) initialization method [kaiming] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, *kwds)) File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 12, in arg_wrapper_mp return args0 File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 33, in cnn_eval evaluation = train(net, gpu_id, epoch_num=epoch_num, out_model=None) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 154, in call init_weights(model, 'kaiming') File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 92, in init_weights net.apply(weights_init_kaiming) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) [Previous line repeated 1 more time] File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 294, in apply fn(self) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 71, in weights_init_kaiming init.uniform(m.weight.data, 1.0, 0.02) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 436, in deprecatedinit return meth(*args, **kwargs) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 88, in uniform return _no_graduniform(tensor, a, b) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 14, in _no_graduniform return tensor.uniform_(a, b) RuntimeError: Expected a_in <= b_in to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/exp_main.py", line 36, in cgp.modified_evolution(max_eval=250, mutation_rate=0.1, log_file=args.log_file) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp.py", line 288, in modified_evolution self._evaluation([self.pop[0]], np.array([True])) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp.py", line 231, in _evaluation fp = self.eval_func(net_lists) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 53, in call evaluations[i:i+process_num] = pool.map(arg_wrapper_mp, arg_data) File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value RuntimeError: Expected a_in <= b_in to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)

Can you help me see what the problem is, author@sg-nm

sg-nm commented 4 years ago

This issue probably is caused by the difference of PyTorch version we are using. Please refer to this. https://discuss.pytorch.org/t/expected-a-in-b-in-to-be-true-but-got-false/54025

yuxiaomu commented 4 years ago

@sg-nm Thank you for your quick response. I'll take a closer look at the link you gave me

yuxiaomu commented 4 years ago

I would like to ask my data set is like this, the image is a slab image with a slab number, the label is the slab number , like this,9M5381L510 ,can i use your model to identify it? image

yuxiaomu commented 4 years ago

@sg-nm Excuse me, the code I have been running on a single 1080t gpu for five or six days, but there is no result, the accuracy is still very unstable, when should I stop running?

J-Wu97 commented 4 years ago

/opt/anaconda/bin/python /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/exp_main.py gpu_id: 0 , [['input', 0, 0], ['S_ResBlock_128_1', 0, 0], ['S_ResBlock_64_5', 1, 1], ['S_ResBlock_32_3', 2, 1], ['S_ConvBlock_128_3', 3, 1], ['S_ConvBlock_32_1', 4, 4], ['S_ResBlock_32_5', 5, 4], ['S_ResBlock_128_3', 6, 5], ['full', 7, 7]] Files already downloaded and verified Files already downloaded and verified train num 50000 GPUID : 0 epoch_num : 50 batch_size: 128 /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py:67: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. init.kaiming_normal(m.weight.data, a=0, mode='fan_in') /home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnntrain.py:71: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform. init.uniform(m.weight.data, 1.0, 0.02) initialization method [kaiming] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, kwds)) File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 12, in arg_wrapper_mp return args0 File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 33, in cnn_eval evaluation = train(net, gpu_id, epoch_num=epoch_num, out_model=None) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 154, in call init_weights(model, 'kaiming') File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 92, in init_weights net.apply(weights_init_kaiming) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 293, in apply module.apply(fn) [Previous line repeated 1 more time] File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 294, in apply fn(self) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cnn_train.py", line 71, in weights_init_kaiming init.uniform(m.weight.data, 1.0, 0.02) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 436, in deprecated_init return meth(args, kwargs) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 88, in uniform_ return _no_graduniform(tensor, a, b) File "/opt/anaconda/lib/python3.7/site-packages/torch/nn/init.py", line 14, in _no_graduniform return tensor.uniform_(a, b) RuntimeError: Expected a_in <= b_in to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/exp_main.py", line 36, in cgp.modified_evolution(max_eval=250, mutation_rate=0.1, log_file=args.log_file) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp.py", line 288, in modified_evolution self._evaluation([self.pop[0]], np.array([True])) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp.py", line 231, in _evaluation fp = self.eval_func(net_lists) File "/home/yyk/PycharmProjects/untitled1/cgp-cnn-PyTorch-master/cgp_config.py", line 53, in call evaluations[i:i+process_num] = pool.map(arg_wrapper_mp, arg_data) File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/opt/anaconda/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value RuntimeError: Expected a_in <= b_in to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)

Can you help me see what the problem is, author@sg-nm

hi, I have got the same mistake. So, have you address this problem without substituting the torch version? look forward your reply