

"""simple docstring"""






from collections import OrderedDict

from ...utils import logging
from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
from .configuration_auto import CONFIG_MAPPING_NAMES


_lowerCAmelCase						=		logging.get_logger(__name__)


_lowerCAmelCase						=		OrderedDict(
    [
        # Base model mapping
        ("""albert""", """FlaxAlbertModel"""),
        ("""bart""", """FlaxBartModel"""),
        ("""beit""", """FlaxBeitModel"""),
        ("""bert""", """FlaxBertModel"""),
        ("""big_bird""", """FlaxBigBirdModel"""),
        ("""blenderbot""", """FlaxBlenderbotModel"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallModel"""),
        ("""clip""", """FlaxCLIPModel"""),
        ("""distilbert""", """FlaxDistilBertModel"""),
        ("""electra""", """FlaxElectraModel"""),
        ("""gpt-sw3""", """FlaxGPT2Model"""),
        ("""gpt2""", """FlaxGPT2Model"""),
        ("""gpt_neo""", """FlaxGPTNeoModel"""),
        ("""gptj""", """FlaxGPTJModel"""),
        ("""longt5""", """FlaxLongT5Model"""),
        ("""marian""", """FlaxMarianModel"""),
        ("""mbart""", """FlaxMBartModel"""),
        ("""mt5""", """FlaxMT5Model"""),
        ("""opt""", """FlaxOPTModel"""),
        ("""pegasus""", """FlaxPegasusModel"""),
        ("""regnet""", """FlaxRegNetModel"""),
        ("""resnet""", """FlaxResNetModel"""),
        ("""roberta""", """FlaxRobertaModel"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormModel"""),
        ("""roformer""", """FlaxRoFormerModel"""),
        ("""t5""", """FlaxT5Model"""),
        ("""vision-text-dual-encoder""", """FlaxVisionTextDualEncoderModel"""),
        ("""vit""", """FlaxViTModel"""),
        ("""wav2vec2""", """FlaxWav2Vec2Model"""),
        ("""whisper""", """FlaxWhisperModel"""),
        ("""xglm""", """FlaxXGLMModel"""),
        ("""xlm-roberta""", """FlaxXLMRobertaModel"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for pre-training mapping
        ("""albert""", """FlaxAlbertForPreTraining"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForPreTraining"""),
        ("""big_bird""", """FlaxBigBirdForPreTraining"""),
        ("""electra""", """FlaxElectraForPreTraining"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
        ("""wav2vec2""", """FlaxWav2Vec2ForPreTraining"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Masked LM mapping
        ("""albert""", """FlaxAlbertForMaskedLM"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForMaskedLM"""),
        ("""big_bird""", """FlaxBigBirdForMaskedLM"""),
        ("""distilbert""", """FlaxDistilBertForMaskedLM"""),
        ("""electra""", """FlaxElectraForMaskedLM"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Seq2Seq Causal LM mapping
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""blenderbot""", """FlaxBlenderbotForConditionalGeneration"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallForConditionalGeneration"""),
        ("""encoder-decoder""", """FlaxEncoderDecoderModel"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""marian""", """FlaxMarianMTModel"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""pegasus""", """FlaxPegasusForConditionalGeneration"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Image-classsification
        ("""beit""", """FlaxBeitForImageClassification"""),
        ("""regnet""", """FlaxRegNetForImageClassification"""),
        ("""resnet""", """FlaxResNetForImageClassification"""),
        ("""vit""", """FlaxViTForImageClassification"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        ("""vision-encoder-decoder""", """FlaxVisionEncoderDecoderModel"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Causal LM mapping
        ("""bart""", """FlaxBartForCausalLM"""),
        ("""bert""", """FlaxBertForCausalLM"""),
        ("""big_bird""", """FlaxBigBirdForCausalLM"""),
        ("""electra""", """FlaxElectraForCausalLM"""),
        ("""gpt-sw3""", """FlaxGPT2LMHeadModel"""),
        ("""gpt2""", """FlaxGPT2LMHeadModel"""),
        ("""gpt_neo""", """FlaxGPTNeoForCausalLM"""),
        ("""gptj""", """FlaxGPTJForCausalLM"""),
        ("""opt""", """FlaxOPTForCausalLM"""),
        ("""roberta""", """FlaxRobertaForCausalLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForCausalLM"""),
        ("""xglm""", """FlaxXGLMForCausalLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForCausalLM"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Sequence Classification mapping
        ("""albert""", """FlaxAlbertForSequenceClassification"""),
        ("""bart""", """FlaxBartForSequenceClassification"""),
        ("""bert""", """FlaxBertForSequenceClassification"""),
        ("""big_bird""", """FlaxBigBirdForSequenceClassification"""),
        ("""distilbert""", """FlaxDistilBertForSequenceClassification"""),
        ("""electra""", """FlaxElectraForSequenceClassification"""),
        ("""mbart""", """FlaxMBartForSequenceClassification"""),
        ("""roberta""", """FlaxRobertaForSequenceClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForSequenceClassification"""),
        ("""roformer""", """FlaxRoFormerForSequenceClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForSequenceClassification"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Question Answering mapping
        ("""albert""", """FlaxAlbertForQuestionAnswering"""),
        ("""bart""", """FlaxBartForQuestionAnswering"""),
        ("""bert""", """FlaxBertForQuestionAnswering"""),
        ("""big_bird""", """FlaxBigBirdForQuestionAnswering"""),
        ("""distilbert""", """FlaxDistilBertForQuestionAnswering"""),
        ("""electra""", """FlaxElectraForQuestionAnswering"""),
        ("""mbart""", """FlaxMBartForQuestionAnswering"""),
        ("""roberta""", """FlaxRobertaForQuestionAnswering"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForQuestionAnswering"""),
        ("""roformer""", """FlaxRoFormerForQuestionAnswering"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForQuestionAnswering"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Token Classification mapping
        ("""albert""", """FlaxAlbertForTokenClassification"""),
        ("""bert""", """FlaxBertForTokenClassification"""),
        ("""big_bird""", """FlaxBigBirdForTokenClassification"""),
        ("""distilbert""", """FlaxDistilBertForTokenClassification"""),
        ("""electra""", """FlaxElectraForTokenClassification"""),
        ("""roberta""", """FlaxRobertaForTokenClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForTokenClassification"""),
        ("""roformer""", """FlaxRoFormerForTokenClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForTokenClassification"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        # Model for Multiple Choice mapping
        ("""albert""", """FlaxAlbertForMultipleChoice"""),
        ("""bert""", """FlaxBertForMultipleChoice"""),
        ("""big_bird""", """FlaxBigBirdForMultipleChoice"""),
        ("""distilbert""", """FlaxDistilBertForMultipleChoice"""),
        ("""electra""", """FlaxElectraForMultipleChoice"""),
        ("""roberta""", """FlaxRobertaForMultipleChoice"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMultipleChoice"""),
        ("""roformer""", """FlaxRoFormerForMultipleChoice"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMultipleChoice"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        ("""bert""", """FlaxBertForNextSentencePrediction"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        ("""speech-encoder-decoder""", """FlaxSpeechEncoderDecoderModel"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
    ]
)

_lowerCAmelCase						=		OrderedDict(
    [
        ("""whisper""", """FlaxWhisperForAudioClassification"""),
    ]
)

_lowerCAmelCase						=		_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_MAPPING_NAMES)
_lowerCAmelCase						=		_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_PRETRAINING_MAPPING_NAMES)
_lowerCAmelCase						=		_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MASKED_LM_MAPPING_NAMES)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES)
_lowerCAmelCase						=		_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES
)
_lowerCAmelCase						=		_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModel)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_PRETRAINING_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForPreTraining, head_doc="""pretraining""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_CAUSAL_LM_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForCausalLM, head_doc="""causal language modeling""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_MASKED_LM_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForMaskedLM, head_doc="""masked language modeling""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForSeqaSeqLM, head_doc="""sequence-to-sequence language modeling""", checkpoint_for_example="""t5-base"""
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForSequenceClassification, head_doc="""sequence classification"""
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForQuestionAnswering, head_doc="""question answering""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForTokenClassification, head_doc="""token classification"""
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForMultipleChoice, head_doc="""multiple choice""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForNextSentencePrediction, head_doc="""next sentence prediction"""
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForImageClassification, head_doc="""image classification"""
)







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING





_lowerCAmelCase						=		auto_class_update(FlaxAutoModelForVisionaSeq, head_doc="""vision-to-text modeling""")







class 	__UpperCamelCase    (    _BaseAutoModelClass						):
  _UpperCAmelCase          =		FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING





_lowerCAmelCase						=		auto_class_update(
    FlaxAutoModelForSpeechSeqaSeq, head_doc="""sequence-to-sequence speech-to-text modeling"""
)








"""simple docstring"""






# Lint as: python3
import sys
from collections.abc import Mapping
from typing import TYPE_CHECKING, Dict, Optional

import numpy as np
import pyarrow as pa

from .. import config
from ..utils.logging import get_logger
from ..utils.py_utils import map_nested
from .formatting import TensorFormatter


if TYPE_CHECKING:
 import jax
 import jaxlib

_lowerCAmelCase						=		get_logger()

_lowerCAmelCase						=		None







class 	__UpperCamelCase    (    TensorFormatter[Mapping, "jax.Array", Mapping]						):

  def __init__(		self    ,_A=None    ,_A=None    ,**_A      ):
      '''simple docstring'''

      super().__init__(features=_A      )
      import jax
      from jaxlib.xla_client import Device

      if isinstance(_A    ,_A      ):
          raise ValueError(
              F"""Expected {device} to be a `str` not {type(_A      )}, as `jaxlib.xla_extension.Device` """
              'is not serializable neither with `pickle` nor with `dill`. Instead you can surround '
              'the device with `str()` to get its string identifier that will be internally mapped '
              'to the actual `jaxlib.xla_extension.Device`.'      )
      _lowerCAmelCase       :   int  =    device if isinstance(_A    ,_A      ) else str(jax.devices()[0]      )
      # using global variable since `jaxlib.xla_extension.Device` is not serializable neither
      # with `pickle` nor with `dill`, so we need to use a global variable instead
      global DEVICE_MAPPING
      if DEVICE_MAPPING is None:
          _lowerCAmelCase       :   Any  =    self._map_devices_to_str()
      if self.device not in list(DEVICE_MAPPING.keys()      ):
          logger.warning(
              F"""Device with string identifier {self.device} not listed among the available """
              F"""devices: {list(DEVICE_MAPPING.keys()      )}, so falling back to the default """
              F"""device: {str(jax.devices()[0]      )}."""      )
          _lowerCAmelCase       :   List[str]  =    str(jax.devices()[0]      )
      _lowerCAmelCase       :   int  =    jnp_array_kwargs

  @staticmethod
  def __lowerCamelCase		(		):
      '''simple docstring'''

      import jax

      return {str(_A      ): device for device in jax.devices()}

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      import jax
      import jax.numpy as jnp

      if isinstance(_A    ,_A      ) and column:
          if all(
              isinstance(_A    ,jax.Array      ) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column      ):
              return jnp.stack(_A    ,axis=0      )
      return column

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      import jax
      import jax.numpy as jnp

      if isinstance(_A    ,(str, bytes, type(_A      ))      ):
          return value
      elif isinstance(_A    ,(np.character, np.ndarray)      ) and np.issubdtype(value.dtype    ,np.character      ):
          return value.tolist()

      _lowerCAmelCase       :   Optional[Any]  =    {}

      if isinstance(_A    ,(np.number, np.ndarray)      ) and np.issubdtype(value.dtype    ,np.integer      ):
          # the default int precision depends on the jax config
          # see https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html#double-64bit-precision
          if jax.config.jax_enable_xaa:
              _lowerCAmelCase       :   List[str]  =    {'dtype': jnp.intaa}
          else:
              _lowerCAmelCase       :   Tuple  =    {'dtype': jnp.intaa}
      elif isinstance(_A    ,(np.number, np.ndarray)      ) and np.issubdtype(value.dtype    ,np.floating      ):
          _lowerCAmelCase       :   Any  =    {'dtype': jnp.floataa}
      elif config.PIL_AVAILABLE and "PIL" in sys.modules:
          import PIL.Image

          if isinstance(_A    ,PIL.Image.Image      ):
              _lowerCAmelCase       :   int  =    np.asarray(_A      )

        # using global variable since `jaxlib.xla_extension.Device` is not serializable neither
        # with `pickle` nor with `dill`, so we need to use a global variable instead
      global DEVICE_MAPPING
      if DEVICE_MAPPING is None:
          _lowerCAmelCase       :   Optional[Any]  =    self._map_devices_to_str()

      with jax.default_device(DEVICE_MAPPING[self.device]      ):
          # calling jnp.array on a np.ndarray does copy the data
          # see https://github.com/google/jax/issues/4486
          return jnp.array(_A    ,**{**default_dtype, **self.jnp_array_kwargs}      )

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      import jax

      # support for torch, tf, jax etc.
      if config.TORCH_AVAILABLE and "torch" in sys.modules:
          import torch

          if isinstance(_A    ,torch.Tensor      ):
              return self._tensorize(data_struct.detach().cpu().numpy()[()]      )
      if hasattr(_A    ,'__array__'      ) and not isinstance(_A    ,jax.Array      ):
          _lowerCAmelCase       :   Optional[Any]  =    data_struct.__array__()
      # support for nested types like struct of list of struct
      if isinstance(_A    ,np.ndarray      ):
          if data_struct.dtype == object:  # jax arrays cannot be instantied from an array of objects
              return self._consolidate([self.recursive_tensorize(_A      ) for substruct in data_struct]      )
      elif isinstance(_A    ,(list, tuple)      ):
          return self._consolidate([self.recursive_tensorize(_A      ) for substruct in data_struct]      )
      return self._tensorize(_A      )

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      return map_nested(self._recursive_tensorize    ,_A    ,map_list=_A      )

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      _lowerCAmelCase       :   Union[str, Any]  =    self.numpy_arrow_extractor().extract_row(_A      )
      _lowerCAmelCase       :   int  =    self.python_features_decoder.decode_row(_A      )
      return self.recursive_tensorize(_A      )

  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      _lowerCAmelCase       :   Dict  =    self.numpy_arrow_extractor().extract_column(_A      )
      _lowerCAmelCase       :   List[Any]  =    self.python_features_decoder.decode_column(_A    ,pa_table.column_names[0]      )
      _lowerCAmelCase       :   Optional[Any]  =    self.recursive_tensorize(_A      )
      _lowerCAmelCase       :   Optional[Any]  =    self._consolidate(_A      )
      return column







  def __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

      _lowerCAmelCase       :   Tuple  =    self.numpy_arrow_extractor().extract_batch(_A      )
      _lowerCAmelCase       :   Any  =    self.python_features_decoder.decode_batch(_A      )
      _lowerCAmelCase       :   str  =    self.recursive_tensorize(_A      )
      for column_name in batch:
          _lowerCAmelCase       :   Optional[Any]  =    self._consolidate(batch[column_name]      )
      return batch





