class_docstr: ASR BPE Mixin class that sets up a Tokenizer via a config
  
  This mixin class adds the method `_setup_tokenizer(...)`, which can be used by ASR models
  which depend on subword tokenization.
  
  The setup_tokenizer method adds the following parameters to the class -
      -   tokenizer_cfg: The resolved config supplied to the tokenizer (with `dir` and `type` arguments).
      -   tokenizer_dir: The directory path to the tokenizer vocabulary + additional metadata.
      -   tokenizer_type: The type of the tokenizer. Currently supports `bpe` and `wpe`, as well as `agg`.
      -   vocab_path: Resolved path to the vocabulary text file.
  
  In addition to these variables, the method will also instantiate and preserve a tokenizer
  (subclass of TokenizerSpec) if successful, and assign it to self.tokenizer.
  
  The mixin also supports aggregate tokenizers, which consist of ordinary, monolingual tokenizers.
  If a conversion between a monolongual and an aggregate tokenizer (or vice versa) is detected,
  all registered artifacts will be cleaned up.
docstr: Clean ups any monolingual and some aggregate config items and artifacts.
  We need to do this when we switch from a monolingual tokenizer to an aggregate one
  or go between aggregate tokenizers which could have a different number of languages
docstr_tok: ["Clean","ups","any","monolingual","and","some","aggregate","config","items","and","artifacts",".","We","need","to","do","this","when","we","switch","from","a","monolingual","tokenizer","to","an","aggregate","one","or","go","between","aggregate","tokenizers","which","could","have","a","different","number","of","languages"]
code: def _cleanup_monolingual_and_aggregate_config_and_artifacts_if_needed(
      self,
  ):
      """
      Clean ups any monolingual and some aggregate config items and artifacts.
      We need to do this when we switch from a monolingual tokenizer to an aggregate one
      or go between aggregate tokenizers which could have a different number of languages
      """
      if hasattr(self, "cfg"):
          with open_dict(self.cfg.tokenizer):
              self.cfg.tokenizer.pop("dir", None)
              self.cfg.tokenizer.pop("model_path", None)
              self.cfg.tokenizer.pop("vocab_path", None)
              self.cfg.tokenizer.pop("spe_tokenizer_vocab", None)
              self.cfg.tokenizer.pop("hf_kwargs", None)
  
      # need to de-register any monolingual artifacts if they exist
      if hasattr(self, "artifacts"):
          self.artifacts.pop("tokenizer.model_path", None)
          self.artifacts.pop("tokenizer.vocab_path", None)
          self.artifacts.pop("tokenizer.spe_tokenizer_vocab", None)
  
          # just in case we are replacing one aggregate tokenizer with another one, we better
          # clean up the old aggregate artifacts as well
          for akey in list(self.artifacts.keys()):
              if akey.startswith(
                  "tokenizer."
                  + self.AGGREGATE_TOKENIZERS_DICT_PREFIX
                  + "."
              ):
                  self.artifacts.pop(akey)
  
imports: import os
  from abc import ABC, abstractmethod
  from typing import List
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  import nemo.collections.asr.models
  from nemo.collections.asr.parts.mixins.asr_adapter_mixins import ASRAdapterModelMixin
  from nemo.collections.asr.parts.mixins.streaming import StreamingEncoder
  from nemo.collections.asr.parts.utils import asr_module_utils
  from nemo.collections.asr.parts.utils.rnnt_utils import Hypothesis
  from nemo.collections.common import tokenizers
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling the ASRBPEMixin obj's underlying member method code with example usage: obj._cleanup_monolingual_and_aggregate_config_and_artifacts_if_needed() without return types