-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable-length sequence spaces support #909
Comments
Here's my view on it: I wrote two new For now minibatches aren't supported because of a Theano limitation: lists of variable-length arrays have no corresponding data structure in Theano. @nouiz is aware of the issue, and in a discussion with him today I learned he even has an intern currently working on fixing it. This space could probably be extended to support minibatches of variable-length sequences, as long as sequences in a minibatch have the same length. There is also a toy-ish implementation of a RNN which I wrote for Yoshua's class and which is used by Junyoung for speech synthesis. It uses |
That is so, so good to hear.
Yeah, I could see both |
Er, by that I mean @bartvm and @laurent-dinh. I thought that comment was by Bart (I'm really tired). |
I had another quick look, and it looks like the problem I had with I haven't used @vdumoulin 's spaces, but I guess that they can be used quite flexibly. If you set the number of columns ( In the long-term I would love to see a solution that allows a batch size greater than 1 though. In my case, something I would like to do is create a fixed-length continuous representation of variable-length sequences, and then run that through a normal MLP, which isn't very efficient to do one sentence at a time. Lists of Theano variables are one option, although I have no idea what the performance is like when you have e.g. 250 different Theano variables as an input and need to concatenate them in one of your MLP layers. Another option, although I have no idea if this is feasible at all, is to run the variable-length part of the network first, collect the outputs, and then run the fixed-length part of the network in batch. I'd also be interested to hear what @nouiz and his intern have in mind, and with what timetable. It would be a shame if we start to implement something and then need to rewrite everything once Theano support for variable length batches arrives. |
@bartvm right now |
Well, I meant you could simply pass a n × 1 matrix. I'm not very clear on what allowing mini-batches would entail though. I guess you'd have to be careful because you would be removing some of the stochasticity from the iterators i.e. sequences with the same length will always be part of the same batch. Also, I guess you would have to fix the mini-batch size to min(|{s in S : ||s|| = const.}|) for sequences S, or otherwise scale your cost function depending on the mini-batch size? |
I think we Will merge the list type next week, without scan support or c Fred Le 16 mai 2014 11:28, "Bart" notifications@github.com a écrit :
|
I was wrong. It is now merged! On Fri, May 23, 2014 at 9:02 AM, Frédéric Bastien nouiz@nouiz.org wrote:
|
Pull request #1021 implements batches of variable length using padding and a mask. I think this is a better solution than typed lists because it allows us to loop over the time-axis in a batch. |
Your way will be faster if the difference in length isn't too big. But in As currently scan have a big overhead. The definition of big is probably On Wed, Jul 23, 2014 at 10:07 PM, Bart notifications@github.com wrote:
|
I think we need to centralize efforts on variable length sequences in pylearn2 and really get our act together. I know a lot of people (@bartvm @vdumoulin @laurent-dinh @pascanur) have thought about this problem, and I think we need a centralized record of
Obviously mini-batches where examples are of variable length are an issue. You can really only address this with lists of Theano variables at present.
Since one can get a lot done in sequential modelling with batch size 1 (provided your sequence is long) I would suggest structuring a first pass as being sufficiently general to support batch size > 1, but actually only implement as much as is needed to support batch size = 1.
I therefore propose using this ticket as that collaboration space.
The text was updated successfully, but these errors were encountered: