class_docstr: Select the sample with the highest log probabilities, penalized using either
  a simple length normalization or Google NMT paper's length penalty
class_docstr_tok: ["Select","the","sample","with","the","highest","log","probabilities",",","penalized","using","either","a","simple","length","normalization","or","Google","NMT","paper","'s","length","penalty"]
code: def rank(
      self, tokens: List[List[Tensor]], sum_logprobs: List[List[float]]
  ):
      def scores(logprobs, lengths):
          result = []
          for logprob, length in zip(logprobs, lengths):
              if self.length_penalty is None:
                  penalty = length
              else:
                  # from the Google NMT paper
                  penalty = ((5 + length) / 6) ** self.length_penalty
              result.append(logprob / penalty)
          return result
  
      # get the sequence with the highest score
      lengths = [[len(t) for t in s] for s in tokens]
      return [
          np.argmax(scores(p, l)) for p, l in zip(sum_logprobs, lengths)
      ]
  
imports: from dataclasses import dataclass, field, replace
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.distributions import Categorical
  from .audio import CHUNK_LENGTH
  from .tokenizer import Tokenizer, get_tokenizer
  from .utils import compression_ratio
label_desc: Use image node_id 2 for calling the MaximumLikelihoodRanker obj's underlying member method code with example usage: obj.rank(tokens, sum_logprobs) and returns: unknown, result