Closed bemoregt closed 4 years ago
Can you explain what code and how did you run?
Hi, @pass1825 @Ugness
My Command:
$ python3 image_test.py --cuda 'cpu'
and input image path is changed with ny image path.
What's wrong with me?
MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4
from @bemoregt.
I think your command should be $ python3 image_test.py --cuda cpu
without quotes. Sorry for making confusion.
Same error occured.
RuntimeError: cannot initialize CUDA without ATen_cuda library
and
map_location='cpu'
from @bemoregt.
Sorry. I found why that error occur. I updated the code. Please download it again. or just modify the code in network.py line 27,
self.decoder.append( DecoderCell(size=cfg['Size'][i], in_channel=cfg['Channel'][i], out_channel=cfg['Channel'][i + 1], mode=cfg['PicaNet'][i]).cuda()) self.decoder.append(DecoderCell(size=cfg['Size'][5], in_channel=cfg['Channel'][5], out_channel=1, mode='C').cuda())
self.decoder.append( DecoderCell(size=cfg['Size'][i], in_channel=cfg['Channel'][i], out_channel=cfg['Channel'][i + 1], mode=cfg['PicaNet'][i])) self.decoder.append(DecoderCell(size=cfg['Size'][5], in_channel=cfg['Channel'][5], out_channel=1, mode='C'))
I am really sorry.
JI, @Ugness @pass1825
OK, Thanks.
I'll try that one.
MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4
from @bemoregt.
Hi, @Ugness @pass1825
It's same.
kerb:Pytorch mun$
kerb:Pytorch mun$ python3 image_test.py
Default path : /Users/mun/PiCANet-Implementation/Pytorch
Namespace(batch_size=4, cuda='cuda', image_dir='../test', logdir='log/Image_test', model_dir=None)
/Users/mun/PiCANet-Implementation/Pytorch
Traceback (most recent call last):
File "image_test.py", line 30, in
from @bemoregt
In the Namespace, you can see your argument for cuda is 'cuda'. Namespace(batch_size=4, cuda='cuda', Can you run the code with --cuda cpu? That dashes are double dash(--). Sorry for asking you to run again. Since my env already have GPU and CUDA, it is hard for me to find error.
or if you can modify the code,
please change all of
args.cuda
to
'cpu'
Oh, sheet. I missed, Sorry.
It works, Thank you.
from @bemoregt.
HI, @Ugness @pass1825
At this time, tensorboard not works ..
kerb:Pytorch mun$ tensorboard --logdir=./log/Image_test
Traceback (most recent call last):
File "/usr/local/bin/tensorboard", line 7, in
What's wrong with me?
from @bemoregt
Oops, Sorry. I changed the default log directory to Pytorch/log/Image_test. But did not change the message. Please check with tensorboard --logdir=./Pytorch/log/Image_test I'll change the default dir.
@Ugness @pass1825 님, 안녕하세요?
현재 Pytorch 경로에서 명령어를 날리고 있으므로 텐서보드 로그경로는 --logdir=./log/Image_test 가 맞을거 같습니다.
경로 문제가 아닌거 같습니다. 아니면, 오히려 Pytorch/ 경로에서 명령어를 날리면 안되는 걸수도 있겠군요.
혹시 PiCANet-Implementation/ 경로에서 텐서보드 명령을 날려야 되는게 아닌지요?
@bemoregt 로부터.
Thanks for asking with Korean. If you prefer to use Korean, please realize it to me.
I think I do not exactly understand the problem. If the directory is wrong, there will be no error message and just blank page.
I think there is no problem with using tensorboard at PiCANet-Implementation/ or not. If you have same error, I recommend you to use abstract directory. ex: D:/Ugness/Python/PiCANet-Implementation/Pytorch/log/Image_test
or please check your tensorboard version.
or set the port number with --port=12345 (or other port)
Or I'll make the program to make image file output. Not to use tensorboard. I will add it as soon as possible.
Great!
ASAP, Please~
I uploaded the file output program as image_test_file_output.py. Please check this. Hope to success~
Great~!
나의 iPhone에서 보냄
I uploaded the file output program as image_test_file_output.py. Please check this. Hope to success~
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
kerb:PiCANet-Implementation mun$ python3 image_test_file_output.py
Default path : /Users/mun/PICA2/PiCANet-Implementation
Namespace(batch_size=4, cuda='cpu', image_dir='test', logdir='pytorch/images/Image_test', model_dir=None)
/Users/mun/PICA2/PiCANet-Implementation
Traceback (most recent call last):
File "image_test_file_output.py", line 34, in
I'm using
device = torch.device(args.cuda)
args.model_dir = 'pytorch/models/25epo_210000step.ckpt'
state_dict = torch.load(args.model_dir, map_location='cpu')
Maybe the error occured because the uploaded model is too old. (before the state_dict commit) Please try with 14epo_123000step.ckpt. or other 2018.09.01 uploaded models. If you want some specific step model, please let me know. I'll upload it.
or
Did the code work well for other models? And can you explain the map_location='cpu' was necessary for cpu mode? If it is, I'll fix my code.
Not, Yet ..
Just a wait ~
Thanks.
It's same.
I used 14epo_123000step.ckpt model at this time.
kerb:PiCANet-Implementation mun$ python3 image_test_file_output.py
Default path : /Users/mun/PICA2/PiCANet-Implementation
Namespace(batch_size=4, cuda='cpu', image_dir='test', logdir='pytorch/images/Image_test', model_dir=None)
/Users/mun/PICA2/PiCANet-Implementation
Traceback (most recent call last):
File "image_test_file_output.py", line 34, in
May be Pytorch in Windows10 and MacOSX are so different. --;
from @bemoregt.
I'll test my code again with drive files soon. I remember that those kind of errors with state_dict comes from layer name mismatch. And that error is also case of them. I'll test my code after 8pm(Seoul timezone) (because I have a schedule), but if you want to debug faster, please check the weight names with print(model.state_dict().keys()) and print(loaded_state_dict.keys())
It works on my environment. It would be OS problem or CUDA problem. Maybe somewhere still need CUDA in my code.
odict_keys(['encoder.seq.0.weight', 'encoder.seq.0.bias', 'encoder.seq.2.weight', 'encoder.seq.2.bias', 'encoder.seq.5.weight', 'encoder.seq.5.bias', 'encoder.seq.7.weight', 'encoder.seq.7.bias', 'encoder.seq.10.weight', 'encoder.seq.10.bias', 'encoder.seq.12.weight', 'encoder.seq.12.bias', 'encoder.seq.14.weight', 'encoder.seq.14.bias', 'encoder.seq.17.weight', 'encoder.seq.17.bias', 'encoder.seq.19.weight', 'encoder.seq.19.bias', 'encoder.seq.21.weight', 'encoder.seq.21.bias', 'encoder.seq.24.weight', 'encoder.seq.24.bias', 'encoder.seq.26.weight', 'encoder.seq.26.bias', 'encoder.seq.28.weight', 'encoder.seq.28.bias', 'encoder.conv6.weight', 'encoder.conv6.bias', 'encoder.conv7.weight', 'encoder.conv7.bias', 'decoder.0.bn_en.weight', 'decoder.0.bn_en.bias', 'decoder.0.bn_en.running_mean', 'decoder.0.bn_en.running_var', 'decoder.0.conv1.weight', 'decoder.0.conv1.bias', 'decoder.0.picanet.renet.vertical.weight_ih_l0', 'decoder.0.picanet.renet.vertical.weight_hh_l0', 'decoder.0.picanet.renet.vertical.bias_ih_l0', 'decoder.0.picanet.renet.vertical.bias_hh_l0', 'decoder.0.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_ih_l0', 'decoder.0.picanet.renet.horizontal.weight_hh_l0', 'decoder.0.picanet.renet.horizontal.bias_ih_l0', 'decoder.0.picanet.renet.horizontal.bias_hh_l0', 'decoder.0.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.0.picanet.renet.conv.weight', 'decoder.0.picanet.renet.conv.bias', 'decoder.0.conv2.weight', 'decoder.0.conv2.bias', 'decoder.0.bn_feature.weight', 'decoder.0.bn_feature.bias', 'decoder.0.bn_feature.running_mean', 'decoder.0.bn_feature.running_var', 'decoder.0.conv3.weight', 'decoder.0.conv3.bias', 'decoder.1.bn_en.weight', 'decoder.1.bn_en.bias', 'decoder.1.bn_en.running_mean', 'decoder.1.bn_en.running_var', 'decoder.1.conv1.weight', 'decoder.1.conv1.bias', 'decoder.1.picanet.renet.vertical.weight_ih_l0', 'decoder.1.picanet.renet.vertical.weight_hh_l0', 'decoder.1.picanet.renet.vertical.bias_ih_l0', 'decoder.1.picanet.renet.vertical.bias_hh_l0', 'decoder.1.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_ih_l0', 'decoder.1.picanet.renet.horizontal.weight_hh_l0', 'decoder.1.picanet.renet.horizontal.bias_ih_l0', 'decoder.1.picanet.renet.horizontal.bias_hh_l0', 'decoder.1.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.1.picanet.renet.conv.weight', 'decoder.1.picanet.renet.conv.bias', 'decoder.1.conv2.weight', 'decoder.1.conv2.bias', 'decoder.1.bn_feature.weight', 'decoder.1.bn_feature.bias', 'decoder.1.bn_feature.running_mean', 'decoder.1.bn_feature.running_var', 'decoder.1.conv3.weight', 'decoder.1.conv3.bias', 'decoder.2.bn_en.weight', 'decoder.2.bn_en.bias', 'decoder.2.bn_en.running_mean', 'decoder.2.bn_en.running_var', 'decoder.2.conv1.weight', 'decoder.2.conv1.bias', 'decoder.2.picanet.conv1.weight', 'decoder.2.picanet.conv1.bias', 'decoder.2.picanet.conv2.weight', 'decoder.2.picanet.conv2.bias', 'decoder.2.conv2.weight', 'decoder.2.conv2.bias', 'decoder.2.bn_feature.weight', 'decoder.2.bn_feature.bias', 'decoder.2.bn_feature.running_mean', 'decoder.2.bn_feature.running_var', 'decoder.2.conv3.weight', 'decoder.2.conv3.bias', 'decoder.3.bn_en.weight', 'decoder.3.bn_en.bias', 'decoder.3.bn_en.running_mean', 'decoder.3.bn_en.running_var', 'decoder.3.conv1.weight', 'decoder.3.conv1.bias', 'decoder.3.picanet.conv1.weight', 'decoder.3.picanet.conv1.bias', 'decoder.3.picanet.conv2.weight', 'decoder.3.picanet.conv2.bias', 'decoder.3.conv2.weight', 'decoder.3.conv2.bias', 'decoder.3.bn_feature.weight', 'decoder.3.bn_feature.bias', 'decoder.3.bn_feature.running_mean', 'decoder.3.bn_feature.running_var', 'decoder.3.conv3.weight', 'decoder.3.conv3.bias', 'decoder.4.bn_en.weight', 'decoder.4.bn_en.bias', 'decoder.4.bn_en.running_mean', 'decoder.4.bn_en.running_var', 'decoder.4.conv1.weight', 'decoder.4.conv1.bias', 'decoder.4.picanet.conv1.weight', 'decoder.4.picanet.conv1.bias', 'decoder.4.picanet.conv2.weight', 'decoder.4.picanet.conv2.bias', 'decoder.4.conv2.weight', 'decoder.4.conv2.bias', 'decoder.4.bn_feature.weight', 'decoder.4.bn_feature.bias', 'decoder.4.bn_feature.running_mean', 'decoder.4.bn_feature.running_var', 'decoder.4.conv3.weight', 'decoder.4.conv3.bias', 'decoder.5.bn_en.weight', 'decoder.5.bn_en.bias', 'decoder.5.bn_en.running_mean', 'decoder.5.bn_en.running_var', 'decoder.5.conv1.weight', 'decoder.5.conv1.bias', 'decoder.5.conv2.weight', 'decoder.5.conv2.bias'])
odict_keys(['encoder.seq.0.weight', 'encoder.seq.0.bias', 'encoder.seq.2.weight', 'encoder.seq.2.bias', 'encoder.seq.5.weight', 'encoder.seq.5.bias', 'encoder.seq.7.weight', 'encoder.seq.7.bias', 'encoder.seq.10.weight', 'encoder.seq.10.bias', 'encoder.seq.12.weight', 'encoder.seq.12.bias', 'encoder.seq.14.weight', 'encoder.seq.14.bias', 'encoder.seq.17.weight', 'encoder.seq.17.bias', 'encoder.seq.19.weight', 'encoder.seq.19.bias', 'encoder.seq.21.weight', 'encoder.seq.21.bias', 'encoder.seq.24.weight', 'encoder.seq.24.bias', 'encoder.seq.26.weight', 'encoder.seq.26.bias', 'encoder.seq.28.weight', 'encoder.seq.28.bias', 'encoder.conv6.weight', 'encoder.conv6.bias', 'encoder.conv7.weight', 'encoder.conv7.bias', 'decoder.0.bn_en.weight', 'decoder.0.bn_en.bias', 'decoder.0.bn_en.running_mean', 'decoder.0.bn_en.running_var', 'decoder.0.bn_en.num_batches_tracked', 'decoder.0.conv1.weight', 'decoder.0.conv1.bias', 'decoder.0.picanet.renet.vertical.weight_ih_l0', 'decoder.0.picanet.renet.vertical.weight_hh_l0', 'decoder.0.picanet.renet.vertical.bias_ih_l0', 'decoder.0.picanet.renet.vertical.bias_hh_l0', 'decoder.0.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_ih_l0', 'decoder.0.picanet.renet.horizontal.weight_hh_l0', 'decoder.0.picanet.renet.horizontal.bias_ih_l0', 'decoder.0.picanet.renet.horizontal.bias_hh_l0', 'decoder.0.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.0.picanet.renet.conv.weight', 'decoder.0.picanet.renet.conv.bias', 'decoder.0.conv2.weight', 'decoder.0.conv2.bias', 'decoder.0.bn_feature.weight', 'decoder.0.bn_feature.bias', 'decoder.0.bn_feature.running_mean', 'decoder.0.bn_feature.running_var', 'decoder.0.bn_feature.num_batches_tracked', 'decoder.0.conv3.weight', 'decoder.0.conv3.bias', 'decoder.1.bn_en.weight', 'decoder.1.bn_en.bias', 'decoder.1.bn_en.running_mean', 'decoder.1.bn_en.running_var', 'decoder.1.bn_en.num_batches_tracked', 'decoder.1.conv1.weight', 'decoder.1.conv1.bias', 'decoder.1.picanet.renet.vertical.weight_ih_l0', 'decoder.1.picanet.renet.vertical.weight_hh_l0', 'decoder.1.picanet.renet.vertical.bias_ih_l0', 'decoder.1.picanet.renet.vertical.bias_hh_l0', 'decoder.1.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_ih_l0', 'decoder.1.picanet.renet.horizontal.weight_hh_l0', 'decoder.1.picanet.renet.horizontal.bias_ih_l0', 'decoder.1.picanet.renet.horizontal.bias_hh_l0', 'decoder.1.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.1.picanet.renet.conv.weight', 'decoder.1.picanet.renet.conv.bias', 'decoder.1.conv2.weight', 'decoder.1.conv2.bias', 'decoder.1.bn_feature.weight', 'decoder.1.bn_feature.bias', 'decoder.1.bn_feature.running_mean', 'decoder.1.bn_feature.running_var', 'decoder.1.bn_feature.num_batches_tracked', 'decoder.1.conv3.weight', 'decoder.1.conv3.bias', 'decoder.2.bn_en.weight', 'decoder.2.bn_en.bias', 'decoder.2.bn_en.running_mean', 'decoder.2.bn_en.running_var', 'decoder.2.bn_en.num_batches_tracked', 'decoder.2.conv1.weight', 'decoder.2.conv1.bias', 'decoder.2.picanet.conv1.weight', 'decoder.2.picanet.conv1.bias', 'decoder.2.picanet.conv2.weight', 'decoder.2.picanet.conv2.bias', 'decoder.2.conv2.weight', 'decoder.2.conv2.bias', 'decoder.2.bn_feature.weight', 'decoder.2.bn_feature.bias', 'decoder.2.bn_feature.running_mean', 'decoder.2.bn_feature.running_var', 'decoder.2.bn_feature.num_batches_tracked', 'decoder.2.conv3.weight', 'decoder.2.conv3.bias', 'decoder.3.bn_en.weight', 'decoder.3.bn_en.bias', 'decoder.3.bn_en.running_mean', 'decoder.3.bn_en.running_var', 'decoder.3.bn_en.num_batches_tracked', 'decoder.3.conv1.weight', 'decoder.3.conv1.bias', 'decoder.3.picanet.conv1.weight', 'decoder.3.picanet.conv1.bias', 'decoder.3.picanet.conv2.weight', 'decoder.3.picanet.conv2.bias', 'decoder.3.conv2.weight', 'decoder.3.conv2.bias', 'decoder.3.bn_feature.weight', 'decoder.3.bn_feature.bias', 'decoder.3.bn_feature.running_mean', 'decoder.3.bn_feature.running_var', 'decoder.3.bn_feature.num_batches_tracked', 'decoder.3.conv3.weight', 'decoder.3.conv3.bias', 'decoder.4.bn_en.weight', 'decoder.4.bn_en.bias', 'decoder.4.bn_en.running_mean', 'decoder.4.bn_en.running_var', 'decoder.4.bn_en.num_batches_tracked', 'decoder.4.conv1.weight', 'decoder.4.conv1.bias', 'decoder.4.picanet.conv1.weight', 'decoder.4.picanet.conv1.bias', 'decoder.4.picanet.conv2.weight', 'decoder.4.picanet.conv2.bias', 'decoder.4.conv2.weight', 'decoder.4.conv2.bias', 'decoder.4.bn_feature.weight', 'decoder.4.bn_feature.bias', 'decoder.4.bn_feature.running_mean', 'decoder.4.bn_feature.running_var', 'decoder.4.bn_feature.num_batches_tracked', 'decoder.4.conv3.weight', 'decoder.4.conv3.bias', 'decoder.5.bn_en.weight', 'decoder.5.bn_en.bias', 'decoder.5.bn_en.running_mean', 'decoder.5.bn_en.running_var', 'decoder.5.bn_en.num_batches_tracked', 'decoder.5.conv1.weight', 'decoder.5.conv1.bias', 'decoder.5.conv2.weight', 'decoder.5.conv2.bias'])
In my case, my (saved model) and (model to load) has different keys but the code works well. I upgraded my pytorch version to 0.4.1. So I think it is a problem of pytorch version or OS.
Please check this issue. It looks similar. https://github.com/pytorch/ELF/issues/15
I'm also 0.4.1 upgrded.
Is it a OS Problem ?
--;
On the other issue, they recommend to install pytorch from source, not pip. But I'm not sure that would work. Or make model to evaluation mode first and then try to load state_dict.
model.eval()
model.load_state_dict(state_dict)
Other Pytorch sources working well in MacOSX.
Windows10 's Pytorch is specific? May be...
Dose the loading error occur in other codes? like train.py or image_test_tensorboard.py
Thanks a lot.
2018-09-06 21:38 GMT+09:00, Yoo Jaehoon notifications@github.com:
I am going to simulate your environment
(MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4.1)
in docker. If I solve the problem, I'll send a mail to you. Thanks.
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Ugness/PiCANet-Implementation/issues/5#issuecomment-419077657
I could not find OSX docker image. But when I test the code in Linux env(https://hub.docker.com/r/pytorch/pytorch), code works. I'll try to upload my own docker image ASAP. If you want, you can run the code on pytorch/pytorch:latest docker image.
Updated. Check readme.md. But, it's my first time to make docker image, the image is very unstable. You can just directly run docker with
docker run --name=torch -it -rm pytorch/pytorch
pip install tensorboardX
pip install datetime
git clone https://github.com/Ugness/PiCANet-Implementation
Hi, @pass1825 @Ugness
I've met this error at cpu mode:
RuntimeError: cannot initialize CUDA without ATen_cuda library
What's wrong with me?
from @bemoregt