-
Notifications
You must be signed in to change notification settings - Fork 311
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
Sampling from RNN #304
Comments
@yashmaverick If you want to sample from the model, you should feed inputs one at a time. So suppose I want to condition the model on rnn:evaluate()
local input = t1
local samples = {}
for i=1,n do
local output = rnn:forward( {input} )
table.insert(samples, output[1])
input = output[1]
end
print("generated sequence: ", sample) Does this make sense to you?
No I think for training it is best to have, like you say, |
@nicholas-leonard |
@yashmaverick Yes use rnn:remember('eval')! |
@nicholas-leonard @yashmaverick Should |
@nicholas-leonard I'm having interesting interactions between
If I leave out the first Could you maybe tell if the remember call should be placed inside or outside? Am I missing out on something else? Thanks! |
@nicholas-leonard
I am trying to predict the next number in a sequence, where each sequence is of length say 5.
For example: input is
{1,2,3,4,5}
target is
{2,3,4,5,6}
Training set has 1000 such sequences
Validation set has 100 sequences
Model is as shown below:
SeqLen = 5
rho = 5
-- no .of steps BPTTbatchSize = 1
hiddenSize = 20
inputSize = 1
outputSize = 1
no_sampling = 10
model = nn.Sequential()
:add(nn.Sequencer(nn.FastLSTM(inputSize,hiddenSize)))
:add(nn.Sequencer(nn.Linear(hiddenSize, outputSize)))
:add(nn.Sequencer(nn.ReLU()))
While inference, how to do sampling from the model ??
I wish to sample from the model 10 times (say 10 trials).
While sampling at first time,
inputs are
{t1,t2,t3,t4,t5}
and true output is say{t2,t3,t4,t5,t6}
andif the model predicts
{t2',t3',t4',t5',t6'}
Next time when I sample, what will be my inputs?
Case1: inputs
{t2,t3,t4,t5,t6'}
orCase2:
{t2',t3',t4',t5',t6'}
Case3: only
{t6'}
, if I go on sampling indefinitely like this, is there a chance that predictions afterrho
trail here (5th trial) are same ??But in either of Case1 and Case2, to sample for 5th time, my inputs will be completely
predictions i.e
{t6',t7',t8',t9',t10'}.
The issue is only with sampling for first four trials during sampling.Also, will it be good if I treat this problem as 'Sequence to One' prediction, where during training the inputs are
{1,2,3,4,5}
and target is{6}
??The text was updated successfully, but these errors were encountered: