score
is usually used to score an existing prediction. You could define a custom model that extends the base SequenceClassifier
, something like:class MyClassifier(onmt.models.SequenceClassifier):
def __init__(self):
super(MyClassifier, self).__init__(...)
def call(self, *args, **kwargs):
logits, _ = super(MyClassifier, self).super(*args, **kwargs)
predictions = dict(probs=tf.nn.softmax(logits))
return logits, predictions
def print_prediction(self, prediction, params=None, stream=None):
print(prediction["probs"], file=stream)
GatherTree
which means I have to set beam_width
to 1
when exporting my model. The thing is that the result of beam_width set to 1 is utter nonsense compared to when beam_width is set to say 5.