docstr: Check whether decoding for a sentence is finished, which
  occurs when the list of finalized sentences has reached the
  beam size, or when we reach the maximum length.
code: def is_finished(
      self,
      step: int,
      unfin_idx: int,
      max_len: int,
      finalized_sent_len: int,
      beam_size: int,
  ):
      """
      Check whether decoding for a sentence is finished, which
      occurs when the list of finalized sentences has reached the
      beam size, or when we reach the maximum length.
      """
      assert finalized_sent_len <= beam_size
      if finalized_sent_len == beam_size or step == max_len:
          return True
      return False
  
imports: import math
  import sys
  from typing import Dict, List, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from fairseq import search, utils
  from fairseq.data import data_utils
  from fairseq.models import FairseqIncrementalDecoder
  from fairseq.ngram_repeat_block import NGramRepeatBlock
label_desc: Use image node_id 10 for calling the SequenceGenerator obj's underlying member method code with example usage: obj.is_finished(step, unfin_idx, max_len, finalized_sent_len, beam_size) and returns: False, True