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_decoder_start_token_id(
      self, decoder_start_token_id: int = None, bos_token_id: int = None
  ) -> int:
      decoder_start_token_id = (
          decoder_start_token_id
          if decoder_start_token_id is not None
          else self.config.decoder_start_token_id
      )
      bos_token_id = (
          bos_token_id
          if bos_token_id is not None
          else self.config.bos_token_id
      )
  
      if decoder_start_token_id is not None:
          return decoder_start_token_id
      elif (
          hasattr(self.config, "decoder")
          and hasattr(self.config.decoder, "decoder_start_token_id")
          and self.config.decoder.decoder_start_token_id is not None
      ):
          return self.config.decoder.decoder_start_token_id
      elif bos_token_id is not None:
          return bos_token_id
      elif (
          hasattr(self.config, "decoder")
          and hasattr(self.config.decoder, "bos_token_id")
          and self.config.decoder.bos_token_id is not None
      ):
          return self.config.decoder.bos_token_id
      raise ValueError(
          "`decoder_start_token_id` or `bos_token_id` has to be defined for encoder-decoder generation."
      )
  
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 8 for calling the GenerationMixin obj's underlying member method code with example usage: obj._get_decoder_start_token_id(decoder_start_token_id, bos_token_id) and returns: decoder_start_token_id, self, bos_token_id, self