CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

How to set nbruttsineachrecurrentiter for reader in python?

Open main76 opened this issue 9 years ago • 4 comments

I used to train my model using BrainScript, the configuration of the reader was like:

reader=[
    ...
    frameMode=false      
    nbruttsineachrecurrentiter=64
    ...
]

So, while using python how do I set nbruttsineachrecurrentiter for the reader?

reader = MinibatchSource(deserializers, randomize=true, truncation_length=donotknow)

I need to set truncation_length, right? But I thought the truncation_length should be equal to mbSize.

Thanks.

main76 avatar Mar 31 '17 09:03 main76

Let me double check - you are using BPTT mode, correct? truncation=true in the brain script config?

eldakms avatar Mar 31 '17 09:03 eldakms

@eldakms yea, I'm using truncated BPTT.

main76 avatar Mar 31 '17 09:03 main76

In brain script, BPTT was inconsistent with frame and utterance mode, mbsize was actually a truncation length and nbruttsineachrecurrentiter specified how many parallel sequences you want to pack in the minibatch. So the real size of the minibatch in samples was mbsize * nbruttsineachrecurrentiter.

Let's say you specify mbSize = 16, nbruttsineachrecurrentiter = 128, in total 2048 samples per minibatch.

In V2, python or the new configuration (with deserializers) we made BPTT consistent with frame mode and utterance mode: mbSize is always the total size of the minibatch in samples truncationLength is the truncation length

So for the sample above you have to specify mbSize = 2048, truncationLength = 16. nbruttsineachrecurrentiter is removed completely.

Hope this makes it clear. Thanks!

eldakms avatar Mar 31 '17 09:03 eldakms

@eldakms Many thanks!

main76 avatar Mar 31 '17 09:03 main76