examples/research_projects/bertabs/modeling_bertabs.py/PenaltyBuilder/length_average
class PenaltyBuilder:    def length_average(self, beam, logprobs, alpha=0.0):
        """
        Returns the average probability of tokens in a sequence.
        """
        return logprobs / len(beam.next_ys)