udibr / headlines

Automatically generate headlines to short articles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue Generating Predictions

lakorab opened this issue · comments

When executing the command

samples = gensamples(X=X, skips=2, batch_size=batch_size, k=10, temperature=1.)

If X is the same size of maxlend nothing gets outputted. If X is larger or smaller than maxlend then I get the following error:

'HEADS:

IndexError Traceback (most recent call last)
in ()
----> 1 samples = gensamples(X=X, skips=2, batch_size=batch_size, k=10, temperature=1.)

in gensamples(X, X_test, Y_test, avoid, avoid_score, skips, k, batch_size, short, temperature, use_unk)
38 fold_start = vocab_fold(start)
39 sample, score = beamsearch(predict=keras_rnn_predict, start=fold_start, avoid=avoid, avoid_score=avoid_score,
---> 40 k=k, temperature=temperature, use_unk=use_unk)
41 assert all(s[maxlend] == eos for s in sample)
42 samples += [(s,start,scr) for s,scr in zip(sample,score)]

in beamsearch(predict, start, avoid, avoid_score, k, maxsample, use_unk, oov, empty, eos, temperature)
27 # for every possible live sample calc prob for every possible label
28 probs = predict(live_samples, empty=empty)
---> 29 assert vocab_size == probs.shape[1]
30
31 # total score for every sample is sum of -log of word prb

IndexError: tuple index out of range'