SeanNaren / warp-ctc

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

Segmentation fault (core dumped) #107

Closed Dinghow closed 5 years ago

Dinghow commented 5 years ago

I run the example code in README

import torch
from warpctc_pytorch import CTCLoss
ctc_loss = CTCLoss()
# expected shape of seqLength x batchSize x alphabet_size
probs = torch.FloatTensor([[[0.1, 0.6, 0.1, 0.1, 0.1], [0.1, 0.1, 0.6, 0.1, 0.1]]]).transpose(0, 1).contiguous()
labels = torch.IntTensor([1, 2])
label_sizes = torch.IntTensor([2])
probs_sizes = torch.IntTensor([2])
probs.requires_grad_(True)  # tells autograd to compute gradients for probs
cost = ctc_loss(probs, labels, probs_sizes, label_sizes)
cost.backward()

When I execute to cost = ctc_loss(probs, labels, probs_sizes, label_sizes), python crashed with 'Segmentation fault (core dumped)'

My python version is 3.6, pytorch is 1.0.0

ZGAI commented 5 years ago

I get the same problem. @Dinghow Have you solved the problem yet?

Dinghow commented 5 years ago

@ZGAI Not yet

ZGAI commented 5 years ago

@SeanNaren Hi, Could you give us any help? Thanks!

ZGAI commented 5 years ago

@Dinghow I have solved it now. You should upgrade your gcc. I upgrade my gcc from 4.8.5 -> 5.4.0.

Dinghow commented 5 years ago

@ZGAI Thanks, I will try that way

kobenaxie commented 5 years ago

Hi, do we need reinstall pytorch and warp_ctc after upgrade GCC ?

Marcovaldong commented 5 years ago

@ZGAI After upgrading the gcc version, did you reinstall the module again? I tried to upgrade the gcc version, tested the module without reinstall it and still got the error (Segmentation fault (core dumped)).

When I compiled and reinstall the module with gcc 5.4.0, I got the current error when import CTCLoss, did you got this problem?

In [2]: from warpctc_pytorch import CTCLoss

ImportError Traceback (most recent call last)

in ----> 1 from warpctc_pytorch import CTCLoss /disk2/dongsq/environments/python3.6/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg/warpctc_pytorch/__init__.py in 4 from torch.nn import Module 5 ----> 6 from ._warp_ctc import * 7 8 ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /disk2/dongsq/environments/python3.6/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg/warpctc_pytorch/_warp_ctc.cpython-36m-x86_64-linux-gnu.so)
Marcovaldong commented 5 years ago

@ZGAI After upgrading the gcc version, did you reinstall the module again? I tried to upgrade the gcc version, tested the module without reinstall it and still got the error (Segmentation fault (core dumped)).

When I compiled and reinstall the module with gcc 5.4.0, I got the current error when import CTCLoss, did you got this problem?

In [2]: from warpctc_pytorch import CTCLoss

ImportError Traceback (most recent call last) in ----> 1 from warpctc_pytorch import CTCLoss

/disk2/dongsq/environments/python3.6/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg/warpctc_pytorch/init.py in 4 from torch.nn import Module 5 ----> 6 from ._warp_ctc import * 7 8

ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /disk2/dongsq/environments/python3.6/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg/warpctc_pytorch/_warp_ctc.cpython-36m-x86_64-linux-gnu.so)

I have solved it now. I got this because that I didn't update the softlink of libstdc++.so.6