code: def __init__(
      self,
      data_source: DataSource,
      tensorizers: Dict[str, Tensorizer],
      batcher: Batcher = None,
      sort_key: Optional[str] = None,
      in_memory: Optional[bool] = False,
      init_tensorizers: Optional[bool] = True,
      init_tensorizers_from_scratch: Optional[bool] = True,
      decoupled_source: bool = False,
      decoupled_target: bool = False,
      noisy_decoupling: bool = False,
      filter_target_ood_slots: bool = True,
      merge_source_vocab: bool = False,
      merge_vocab: Optional[bool] = True,
      unk_token: str = Config.unk_token,
      pad_token: str = Config.pad_token,
      bos_token: str = Config.bos_token,
      eos_token: str = Config.eos_token,
      mask_token: str = Config.mask_token,
  ):
      super().__init__(
          data_source,
          tensorizers,
          batcher,
          sort_key,
          in_memory,
          init_tensorizers,
          init_tensorizers_from_scratch,
      )
      self.filter_target_ood_slots = filter_target_ood_slots
      self.merge_source_vocab = merge_source_vocab
      self.merge_vocab = merge_vocab
  
      if decoupled_source and noisy_decoupling:
          self.decoupled_func_source = get_noisy_decoupled
      elif decoupled_source:
          self.decoupled_func_source = get_blind_decoupled
      else:
          self.decoupled_func_source = (
              lambda x, filter_ood_slots=None: x
          )
  
      if decoupled_target and noisy_decoupling:
          self.decoupled_func_target = get_noisy_decoupled
      elif decoupled_target:
          self.decoupled_func_target = get_blind_decoupled
      else:
          self.decoupled_func_target = (
              lambda x, filter_ood_slots=None: x
          )
  
      # Don't mess with the tensorizers if they're being loaded from a saved state.
      if init_tensorizers:
          # Unify special tokens across encoder and decoder.
          new_specials = [
              unk_token,
              pad_token,
              bos_token,
              eos_token,
              mask_token,
          ]
          src_vocab = self.tensorizers["src_seq_tokens"].vocab
          trg_vocab = self.tensorizers["trg_seq_tokens"].vocab
          self._replace_tokens(src_vocab, *new_specials)
          self._replace_tokens(trg_vocab, *new_specials)
  
          # Tensorizers inheriting from BertSeqLabelingTensorizerBase use a class-level
          # bos_token to encode inputs, so update the src tensorizer's bos_token if it exists.
          if hasattr(self.tensorizers["src_seq_tokens"], "bos_token"):
              self.tensorizers["src_seq_tokens"].bos_token = bos_token
  
          # Merge source and target vocabs, keeping them aligned. This is required
          # by the implementation of the pointer mechanism in the model's decoder.
          if merge_vocab:
              src_vocab = self.tensorizers["src_seq_tokens"].vocab
              trg_vocab = self.tensorizers["trg_seq_tokens"].vocab
              tokens_not_in_src = set(trg_vocab._vocab).difference(
                  set(src_vocab._vocab)
              )
              merged_tokens = src_vocab._vocab.copy() + [
                  w for w in trg_vocab._vocab if w in tokens_not_in_src
              ]  # Order stays consistent with trg vocab. No randomness from set.
              merged_vocab = Vocabulary(
                  vocab_list=merged_tokens,
                  replacements=None,
                  unk_token=unk_token,
                  pad_token=pad_token,
                  bos_token=bos_token,
                  eos_token=eos_token,
                  mask_token=mask_token,
              )
              print(f"Source vocab: {len(src_vocab)} entries.")
              print(f"Target vocab: {len(trg_vocab)} entries.")
              print(f"Merged vocab: {len(merged_vocab)} entries.")
  
              if self.merge_source_vocab:
                  self.tensorizers[
                      "src_seq_tokens"
                  ].vocab = merged_vocab
                  print(
                      "\tInitialized source tensorizer with merged vocab."
                  )
  
              self.tensorizers["trg_seq_tokens"].vocab = merged_vocab
              print(
                  "\tInitialized target tensorizer with merged vocab."
              )
  
file_path: pytext/pytext/data/decoupled_data.py
imports: from typing import Dict, List, Optional, Type
  from .None import Batcher, Data
  from .data import RowData
  from .sources import DataSource
  from .tensorizers import Tensorizer
  from .utils import Vocabulary
label_desc: Use image node_id 3 to create a new DecoupledSeq2SeqData object from inherited base classes: Data with example: obj = DecoupledSeq2SeqData(data_source, tensorizers, batcher, sort_key, in_memory, init_tensorizers, init_tensorizers_from_scratch, decoupled_source, decoupled_target, noisy_decoupling, filter_target_ood_slots, merge_source_vocab, merge_vocab, unk_token, pad_token, bos_token, eos_token, mask_token)