class_docstr: A class containing all of the functions supporting generation, to be used as a mixin in
  :class:`~transformers.PreTrainedModel`.
class_docstr_tok: ["A","class","containing","all","of","the","functions","supporting","generation",",","to","be","used","as","a","mixin","in",":","class",":","`","~transformers.PreTrainedModel","`","."]
code: def _get_stopping_criteria(
      self,
      max_length: Optional[int],
      max_time: Optional[float],
      max_new_tokens: Optional[int],
      start_length: int,
  ) -> StoppingCriteriaList:
      stopping_criteria = StoppingCriteriaList()
      if max_length is not None:
          stopping_criteria.append(
              MaxLengthCriteria(max_length=max_length)
          )
      if max_time is not None:
          stopping_criteria.append(MaxTimeCriteria(max_time=max_time))
      if max_new_tokens is not None:
          stopping_criteria.append(
              MaxNewTokensCriteria(
                  start_length=start_length,
                  max_new_tokens=max_new_tokens,
              )
          )
      return stopping_criteria
  
imports: from dataclasses import dataclass
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
  from .file_utils import ModelOutput
  from .generation_beam_search import BeamScorer, BeamSearchScorer
  from .generation_logits_process import EncoderNoRepeatNGramLogitsProcessor, ForcedBOSTokenLogitsProcessor, ForcedEOSTokenLogitsProcessor, HammingDiversityLogitsProcessor, InfNanRemoveLogitsProcessor, LogitsProcessorList, MinLengthLogitsProcessor, NoBadWordsLogitsProcessor, NoRepeatNGramLogitsProcessor, PrefixConstrainedLogitsProcessor, RepetitionPenaltyLogitsProcessor, TemperatureLogitsWarper, TopKLogitsWarper, TopPLogitsWarper
  from .generation_stopping_criteria import MaxLengthCriteria, MaxNewTokensCriteria, MaxTimeCriteria, StoppingCriteriaList, validate_stopping_criteria
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.core.log import logger
label_desc: Use image node_id 14 for calling the GenerationMixin obj's underlying member method code with example usage: obj._get_stopping_criteria(max_length, max_time, max_new_tokens, start_length) and returns: stopping_criteria