SeanNaren / warp-ctc

Pytorch Bindings for warp-ctc
Apache License 2.0
757 stars 271 forks source link

AttributeError: type object '_CTC' has no attribute 'apply' #22

Open vivounicorn opened 6 years ago

vivounicorn commented 6 years ago

hi @SeanNaren, there is something wrong with CTCLoss of pytorch binding:

import torch from torch.autograd import Variable from warpctc_pytorch import CTCLoss ctc_loss = CTCLoss() Traceback (most recent call last): File "", line 1, in File "/root/anaconda2/envs/chinese-ocr/lib/python2.7/site-packages/warpctc_pytorch/init.py", line 55, in init self.ctc = _CTC.apply AttributeError: type object '_CTC' has no attribute 'apply' is there some way to solve it?

vivounicorn commented 6 years ago

May be the version of pytorch is too low.

LMig2k commented 6 years ago

i have the same problem on pytorch 0.1.12

SeanNaren commented 6 years ago

@vivounicorn what version you using? @LMig2k I'd suggest updating the pytorch version if possible

zxczhkzxc commented 6 years ago

i meet this problem,do you fix it?@LMig2k@vivounicorn

w7851435 commented 6 years ago

i meet the same error..

zxczhkzxc commented 6 years ago

i try to update the version of pytorch and solve the problem

gbolin commented 6 years ago

Do not use pytorch 0.1.12, its _CTC function does not have attribute apply. here is the proof. vim warp-ctc/pytorch_binding/warpctc_pytorch/init.py +60 we know that 'apply' from _CTC function, and the _CTC inherits the Function in init.py row 3, the Function imported from torch.autograd. ok, track the torch source code from the website the Function surely does not have apply attribute, we can get a compare result form pytorch 0.2.0 or 0.3.1 so I guess it's a bug here, use a higher version pytorch instead