class_docstr: Dense video captioning module that encodes a video and generate tokens.
code: def _get_decoder(
      self,
      dec_type: str,
      dec_config: ml_collections.ConfigDict,
      num_bins: int,
      tmp_only: bool = False,
  ):
      if (
          dec_type == "t5_decoder"
      ):  # add timestamp tokens to the vocabulary
          t5_config = t5_pretrained.CONFIGS[
              dec_config.pretrained_config
          ]
          t5_config["dropout_rate"] = dec_config.dropout_rate
          t5_config[
              "logits_via_embedding"
          ] = dec_config.logits_via_embedding
          if tmp_only:
              t5_config["vocab_size"] = num_bins + 2
          else:
              t5_config["vocab_size"] = 32128 + num_bins
          decoder_embedder = t5_model.t5_layers.Embed(
              num_embeddings=t5_config["vocab_size"],
              features=t5_config["emb_dim"],
              dtype=t5_config["dtype"],
              attend_dtype=jnp.float32,  # For logit training stability.
              embedding_init=nn.initializers.normal(stddev=1.0),
              one_hot=True,
              name="shared_decoder_token_embedder",
          )
          decoder = t5_model.T5Decoder(
              **t5_config,
              shared_embedding=decoder_embedder,
              name="text_decoder",
          )
      else:
          raise ValueError(f"Unrecognized decoder type: {dec_type}.")
  
      return (decoder_embedder, decoder)
  
imports: import functools
  from typing import Any, Dict, Mapping, Optional, Tuple
  from absl import logging
  import flax.linen
  from flax.training import common_utils
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.projects.baselines import vit
  from scenic.projects.t5 import layers
  from scenic.projects.t5 import model
  from t5x import decoding
  from t5x.models import DecodeFnCallable
label_desc: Use image node_id 2 for calling the DenseVideoCaptioningModule obj's underlying member method code with example usage: obj._get_decoder(dec_type, dec_config, num_bins, tmp_only) and returns: decoder_embedder,  decoder