Install warp-ctc first using cmake
mkdir build
cd build
cmake ..
make
Now, go to the python directory and run sudo python setup.py install
Numpy and Theano bindings for Baidu's warp-ctc
License: Apache License 2.0
Install warp-ctc first using cmake
mkdir build
cd build
cmake ..
make
Now, go to the python directory and run sudo python setup.py install
Hi @sherjilozair ,
Could you please run file rnnctc.py
in my forked repo:
https://github.com/mohammadpz/ctc/blob/master/examples/rnnctc.py
Variable gradsx2
should be twice larger than grads
. But it's not the case
Am I missing something?
Hi,
I'm trying to install ctc on an AWS instance with gpu (p2.xlarge). Ubuntu 14.04.
I have installed warp_ctc and successfully run test_gpu and test_cpu.
After running
sudo python setup.py install
I get the following error:
ubuntu@ip-172-31-21-85:~/ctc/examples$ python simple.py
Traceback (most recent call last):
File "simple.py", line 1, in <module>
from ctc import cpu_ctc_th, cpu_ctc_np
File "/usr/local/lib/python2.7/dist-packages/ctc/__init__.py", line 1, in <module>
from .ctc import cpu_ctc_np, cpu_ctc_th
File "/usr/local/lib/python2.7/dist-packages/ctc/ctc.py", line 18, in <module>
libwarpctc = npct.load_library(os.path.join(os.path.dirname(__file__), "../build/libwarpctc.{}".format(ext)), "")
File "/usr/local/lib/python2.7/dist-packages/numpy/ctypeslib.py", line 155, in load_library
raise OSError("no file with expected extension")
OSError: no file with expected extension
ubuntu@ip-172-31-21-85:~/ctc/examples$
Any ideas on how to fix this? I have printed
os.path.dirname(__file__)
and it is empty.
Thanks!
First, a big thanks for making this so easy-to-use and including an example. Just a quick note - I think on the rnnctc example:
h3 = lasagne.layers.RecurrentLayer(h2, num_classes, grad_clipping=grad_clip,
nonlinearity=lasagne.nonlinearities.linear)
l_out = lasagne.layers.ReshapeLayer(h3, ((max_len, mbsz, num_classes)))
network_output = lasagne.layers.get_output(l_out)
should be:
h3 = lasagne.layers.RecurrentLayer(h2, num_classes, grad_clipping=grad_clip,
nonlinearity=lasagne.nonlinearities.linear)
l_out = lasagne.layers.DimshuffleLayer(h3, (1, 0, 2))
network_output = lasagne.layers.get_output(l_out)
The reshape works fine when the batch size is 1, but may cause problems when people use bigger batch sizes.
Here's a snippet of code I use for dense layers as well - the non-flattening dense layers might be useful to others to include to show them how to use the RNNs effectively:
# (batch size, max sequence length, number of features)
l_in = lasagne.layers.InputLayer(shape=(None, None, inp_dim), input_var=input_var)
# Mask as matrices of dimensionality (N_BATCH, MAX_LENGTH)
l_mask = lasagne.layers.InputLayer(shape=(None, None), input_var=mask_var)
# Allows arbitrary sizes
batch_size, seq_len, _ = input_var.shape
# RNN layers
l_forward = lasagne.layers.GRULayer(
l_in, num_hidden, mask_input=l_mask, grad_clipping=GRAD_CLIP)
l_backward = lasagne.layers.GRULayer(
l_in, num_hidden, mask_input=l_mask, grad_clipping=GRAD_CLIP, backwards=True)
# Now, we'll concatenate the outputs to combine them.
l_concat = lasagne.layers.ConcatLayer([l_forward, l_backward], axis=2)
# Dense layers
l_nfd1 = non_flattening_dense(l_concat, batch_size, seq_len, num_units=num_hidden,
nonlinearity=lasagne.nonlinearities.rectify)
l_nfd2 = non_flattening_dense(l_nfd1, batch_size, seq_len, num_units=num_hidden,
nonlinearity=lasagne.nonlinearities.rectify)
l_out = non_flattening_dense(l_nfd2, batch_size, seq_len, num_units=out_size+1, nonlinearity=lasagne.nonlinearities.linear)
l_reshape = lasagne.layers.DimshuffleLayer(l_out, (1, 0, 2))
return l_reshape
def non_flattening_dense(l_in, batch_size, seq_len, *args, **kwargs):
l_flat = lasagne.layers.ReshapeLayer(l_in, (-1, [2]))
l_dense = lasagne.layers.DenseLayer(l_flat, *args, **kwargs)
# temp_size = l_in.output_shape[1]
# if not temp_size:
# temp_size = -1
l_reshaped = lasagne.layers.ReshapeLayer(l_dense, (batch_size, seq_len, l_dense.output_shape[1]))
return l_reshaped
I see that the code seems to be using only cpu_ctc.
How can I get this to use the gpu?
Thanks
Avi
AttributeError: /usr/local/lib/python2.7/dist-packages/ctc/../build/libwarpctc.so: undefined symbol: cpu_ctc
Problem: AttributeError: module 'ctc' has no attribute 'cpu_ctc_th'
Someone told me the problem might be that ctc writes in another directory. I checked.
When I install setup.py, it writes here:
/usr/local/lib/python3.6/site-packages/ctc-0.1-py3.6.egg-info
And Spyder uses another Python within Anaconda. Can someone tell me how to change where ctc writes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.