Giter VIP home page Giter VIP logo

ctc's Introduction

ctc's People

Contributors

dannyneil avatar noammor avatar sherjilozair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ctc's Issues

use of gpu_ctc

I see that the code seems to be using only cpu_ctc.

How can I get this to use the gpu?

Thanks
Avi

how to change directory where setup.py writes to somewhere I want

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?

undefined symbol: cpu_ctc

AttributeError: /usr/local/lib/python2.7/dist-packages/ctc/../build/libwarpctc.so: undefined symbol: cpu_ctc

CTC on AWS

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!

Reshape vs. Dimshuffle

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.