'Given a model, generate sentences from this dataset.
Args:
model (Model): Image captioning model.
Returns:
list, list containing predicted sentences and target sentences'

def predict(self, model):

    sents = []
    targets = []
    y = self.be.zeros(self.dev_X.shape)
    for (mb_idx, (x, t)) in enumerate(self):
        y.fill(0)
        for step in range(1, (self.max_sentence_length + 1)):
            prob = model.fprop((x[0], y), inference=True).get()[:, :(- self.be.bsz)].copy()
            pred = np.argmax(prob, axis=0)
            prob.fill(0)
            for i in range((step * self.be.bsz)):
                prob[(pred[i], i)] = 1
            y[:] = prob
        sents += self.prob_to_word(y)
        if isinstance(self, ImageCaptionTest):
            targets += t[0]
        else:
            targets.append(t[0])
    return (sents, targets)
