meijieru / crnn.pytorch

Convolutional recurrent network in pytorch
MIT License
2.38k stars 658 forks source link

AttributeError: module 'utils' has no attribute 'data_parallel' when running python demo.py #9

Closed ahmedmazari closed 7 years ago

ahmedmazari commented 7 years ago

Hello, l'm getting this error when running python demo.py. What's wrong with my the code. It seems that crnn.py don't import the utils which is in crnn.pytorch/models/ and import the one which is located in crnn.pytorch/

 python3.5 demo.py 
loading pretrained model from ./data/crnn.pth
Traceback (most recent call last):
  File "demo.py", line 27, in <module>
    preds = model(image)
  File "/home/ahmed/anaconda3/envs/my_env/lib/python3.5/site-packages/torch/nn/modules/module.py", line 206, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ahmed/Downloads/crnn.pytorch-master/models/crnn.py", line 78, in forward
    conv = utils.data_parallel(self.cnn, input, self.ngpu)
AttributeError: module 'utils' has no attribute 'data_parallel'
meijieru commented 7 years ago

I do not meet this problem. Where did you run this program?

ahmedmazari commented 7 years ago

in my laptop with python 3.5 , torch.version '0.1.12_2', cuda 8.0 and cudnn 5.1

ahmedmazari commented 7 years ago

@meijieru , what's wrong around here ?

ahmedmazari commented 7 years ago

@meijieru problem solved with the code proposed by @ daobilige-su in https://github.com/meijieru/crnn.pytorch/issues/1

meijieru commented 7 years ago

I could not reproduce this problem. Since it is OK for you to run demo, I just this issue temporarily.

grkashani commented 6 years ago

copy utils.py from here to your directory https://github.com/grkashani/utils-stanford/blob/master/utils.py