

# 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

a		=get_logger()

a		=None






class 	A_		(	TensorFormatter[Mapping, '''jax.Array''', Mapping]    ):
							def __init__(		self		:      Tuple       ,SCREAMING_SNAKE_CASE__		:      Optional[Any]=None       ,SCREAMING_SNAKE_CASE__		:      Optional[Any]=None       ,**SCREAMING_SNAKE_CASE__		:      int):
								super().__init__(features=SCREAMING_SNAKE_CASE__)
								import jax
								from jaxlib.xla_client import Device

								if isinstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__):
									raise ValueError(
									    F"Expected {device} to be a `str` not {type(SCREAMING_SNAKE_CASE__)}, 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(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__) 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    :    Union[str, Any] 	=			str(jax.devices()[0])
								__lowerCamelCase    :    List[str] 	=			jnp_array_kwargs
							@staticmethod
							def    lowerCAmelCase					(		):
								import jax

								return {str(SCREAMING_SNAKE_CASE__): device for device in jax.devices()}
							def    lowerCAmelCase					(		self		:      Optional[int]       ,SCREAMING_SNAKE_CASE__		:      Any):
								import jax
								import jax.numpy as jnp

								if isinstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__) and column:
									if all(
									    isinstance(SCREAMING_SNAKE_CASE__       ,jax.Array) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column):
										return jnp.stack(SCREAMING_SNAKE_CASE__       ,axis=0)
								return column
							def    lowerCAmelCase					(		self		:      int       ,SCREAMING_SNAKE_CASE__		:      Optional[Any]):
								import jax
								import jax.numpy as jnp

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

								__lowerCamelCase    :    Optional[int] 	=			{}

								if isinstance(SCREAMING_SNAKE_CASE__       ,(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[Any] 	=			{'dtype': jnp.intaa}
									else:
										__lowerCamelCase    :    Optional[int] 	=			{'dtype': jnp.intaa}
								elif isinstance(SCREAMING_SNAKE_CASE__       ,(np.number, np.ndarray)) and np.issubdtype(value.dtype       ,np.floating):
									__lowerCamelCase    :    Tuple 	=			{'dtype': jnp.floataa}
								elif config.PIL_AVAILABLE and "PIL" in sys.modules:
									import PIL.Image

									if isinstance(SCREAMING_SNAKE_CASE__       ,PIL.Image.Image):
										__lowerCamelCase    :    List[Any] 	=			np.asarray(SCREAMING_SNAKE_CASE__)

        # 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    :    Dict 	=			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(SCREAMING_SNAKE_CASE__       ,**{**default_dtype, **self.jnp_array_kwargs})
							def    lowerCAmelCase					(		self		:      Optional[Any]       ,SCREAMING_SNAKE_CASE__		:      Dict):
								import jax

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

									if isinstance(SCREAMING_SNAKE_CASE__       ,torch.Tensor):
										return self._tensorize(data_struct.detach().cpu().numpy()[()])
								if hasattr(SCREAMING_SNAKE_CASE__       ,'__array__') and not isinstance(SCREAMING_SNAKE_CASE__       ,jax.Array):
									__lowerCamelCase    :    int 	=			data_struct.__array__()
								# support for nested types like struct of list of struct
								if isinstance(SCREAMING_SNAKE_CASE__       ,np.ndarray):
									if data_struct.dtype == object:  # jax arrays cannot be instantied from an array of objects
										return self._consolidate([self.recursive_tensorize(SCREAMING_SNAKE_CASE__) for substruct in data_struct])
								elif isinstance(SCREAMING_SNAKE_CASE__       ,(list, tuple)):
									return self._consolidate([self.recursive_tensorize(SCREAMING_SNAKE_CASE__) for substruct in data_struct])
								return self._tensorize(SCREAMING_SNAKE_CASE__)
							def    lowerCAmelCase					(		self		:      Any       ,SCREAMING_SNAKE_CASE__		:      dict):
								return map_nested(self._recursive_tensorize       ,SCREAMING_SNAKE_CASE__       ,map_list=SCREAMING_SNAKE_CASE__)
							def    lowerCAmelCase					(		self		:      Tuple       ,SCREAMING_SNAKE_CASE__		:      pa.Table):
								__lowerCamelCase    :    List[str] 	=			self.numpy_arrow_extractor().extract_row(SCREAMING_SNAKE_CASE__)
								__lowerCamelCase    :    List[str] 	=			self.python_features_decoder.decode_row(SCREAMING_SNAKE_CASE__)
								return self.recursive_tensorize(SCREAMING_SNAKE_CASE__)
							def    lowerCAmelCase					(		self		:      str       ,SCREAMING_SNAKE_CASE__		:      pa.Table):
								__lowerCamelCase    :    Any 	=			self.numpy_arrow_extractor().extract_column(SCREAMING_SNAKE_CASE__)
								__lowerCamelCase    :    Any 	=			self.python_features_decoder.decode_column(SCREAMING_SNAKE_CASE__       ,pa_table.column_names[0])
								__lowerCamelCase    :    List[str] 	=			self.recursive_tensorize(SCREAMING_SNAKE_CASE__)
								__lowerCamelCase    :    Any 	=			self._consolidate(SCREAMING_SNAKE_CASE__)
								return column


							def    lowerCAmelCase					(		self		:      Union[str, Any]       ,SCREAMING_SNAKE_CASE__		:      pa.Table):
								__lowerCamelCase    :    Union[str, Any] 	=			self.numpy_arrow_extractor().extract_batch(SCREAMING_SNAKE_CASE__)
								__lowerCamelCase    :    Any 	=			self.python_features_decoder.decode_batch(SCREAMING_SNAKE_CASE__)
								__lowerCamelCase    :    Optional[int] 	=			self.recursive_tensorize(SCREAMING_SNAKE_CASE__)
								for column_name in batch:
									__lowerCamelCase    :    int 	=			self._consolidate(batch[column_name])
								return batch







from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
					from transformers import (
					    AutoConfig,
					    BertConfig,
					    GPTaConfig,
					    TaConfig,
					    TFAutoModel,
					    TFAutoModelForCausalLM,
					    TFAutoModelForMaskedLM,
					    TFAutoModelForPreTraining,
					    TFAutoModelForQuestionAnswering,
					    TFAutoModelForSeqaSeqLM,
					    TFAutoModelForSequenceClassification,
					    TFAutoModelWithLMHead,
					    TFBertForMaskedLM,
					    TFBertForPreTraining,
					    TFBertForQuestionAnswering,
					    TFBertForSequenceClassification,
					    TFBertModel,
					    TFGPTaLMHeadModel,
					    TFRobertaForMaskedLM,
					    TFTaForConditionalGeneration,
					)
					from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
					from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
					from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
					from transformers import (
					    AutoModel,
					    AutoModelForCausalLM,
					    AutoModelForMaskedLM,
					    AutoModelForPreTraining,
					    AutoModelForQuestionAnswering,
					    AutoModelForSeqaSeqLM,
					    AutoModelForSequenceClassification,
					    AutoModelWithLMHead,
					    BertForMaskedLM,
					    BertForPreTraining,
					    BertForQuestionAnswering,
					    BertForSequenceClassification,
					    BertModel,
					    GPTaLMHeadModel,
					    RobertaForMaskedLM,
					    TaForConditionalGeneration,
					)






@is_pt_tf_cross_test
class 	A_		(	unittest.TestCase    ):
							@slow
							def    lowerCAmelCase					(		self		:      List[str]):
								# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
								for model_name in ["bert-base-uncased"]:
									__lowerCamelCase    :    Optional[int] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Tuple 	=			TFAutoModel.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    str 	=			AutoModel.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      Optional[int]):
								# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
								for model_name in ["bert-base-uncased"]:
									__lowerCamelCase    :    str 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Tuple 	=			TFAutoModelForPreTraining.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    str 	=			AutoModelForPreTraining.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      Optional[int]):
								for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									__lowerCamelCase    :    Union[str, Any] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Union[str, Any] 	=			TFAutoModelForCausalLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    Union[str, Any] 	=			TFAutoModelForCausalLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    List[Any] 	=			AutoModelForCausalLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    Any 	=			AutoModelForCausalLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      List[Any]):
								for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									__lowerCamelCase    :    List[str] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    List[str] 	=			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Optional[Any] 	=			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      Tuple):
								for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									__lowerCamelCase    :    Optional[Any] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Optional[int] 	=			TFAutoModelForMaskedLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    Dict 	=			TFAutoModelForMaskedLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    List[Any] 	=			AutoModelForMaskedLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    Optional[Any] 	=			AutoModelForMaskedLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      str):
								for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									__lowerCamelCase    :    Dict 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Optional[Any] 	=			TFAutoModelForSeqaSeqLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    List[str] 	=			TFAutoModelForSeqaSeqLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Any 	=			AutoModelForSeqaSeqLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									__lowerCamelCase	,			__lowerCamelCase    :    List[str] 	=			AutoModelForSeqaSeqLM.from_pretrained(
									    SCREAMING_SNAKE_CASE__       ,output_loading_info=SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      Optional[Any]):
								# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
								for model_name in ["bert-base-uncased"]:
									__lowerCamelCase    :    List[Any] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Optional[int] 	=			TFAutoModelForSequenceClassification.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    int 	=			AutoModelForSequenceClassification.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							@slow
							def    lowerCAmelCase					(		self		:      Any):
								# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
								for model_name in ["bert-base-uncased"]:
									__lowerCamelCase    :    List[Any] 	=			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    str 	=			TFAutoModelForQuestionAnswering.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)

									__lowerCamelCase    :    Optional[int] 	=			AutoModelForQuestionAnswering.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE__)
									self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
							def    lowerCAmelCase					(		self		:      int):
								__lowerCamelCase    :    List[Any] 	=			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
								self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
								self.assertEqual(model.num_parameters()       ,1_4_4_1_0)
								self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__)       ,1_4_4_1_0)

								__lowerCamelCase    :    Union[str, Any] 	=			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
								self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
								self.assertEqual(model.num_parameters()       ,1_4_4_1_0)
								self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__)       ,1_4_4_1_0)


							def    lowerCAmelCase					(		self		:      Tuple):
								__lowerCamelCase    :    str 	=			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_pt=SCREAMING_SNAKE_CASE__)
								self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
								self.assertEqual(model.num_parameters()       ,1_4_4_1_0)
								self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__)       ,1_4_4_1_0)

								__lowerCamelCase    :    Optional[int] 	=			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,from_tf=SCREAMING_SNAKE_CASE__)
								self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__)
								self.assertEqual(model.num_parameters()       ,1_4_4_1_0)
								self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__)       ,1_4_4_1_0)




