



"""simple docstring"""

import argparse
import json
from pathlib import Path

import torch
import torchaudio
from datasets import load_dataset
from huggingface_hub import hf_hub_download

from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification
from transformers.utils import logging


logging.set_verbosity_info()
lowercase__					:						Dict												=			logging.get_logger(__name__)




def __lowercase    (							_a					):
    snake_case_				:  Union[str, Any]       =			ASTConfig()

    if "10-10" in model_name:
        pass
    elif "speech-commands" in model_name:
        snake_case_				:  Dict       =			128
    elif "12-12" in model_name:
        snake_case_				:  Optional[int]       =			12
        snake_case_				:  Optional[int]       =			12
    elif "14-14" in model_name:
        snake_case_				:  Any       =			14
        snake_case_				:  Dict       =			14
    elif "16-16" in model_name:
        snake_case_				:  List[str]       =			16
        snake_case_				:  List[Any]       =			16
    else:
        raise ValueError('''Model not supported'''					)

    snake_case_				:  Dict       =			"""huggingface/label-files"""
    if "speech-commands" in model_name:
        snake_case_				:  str       =			35
        snake_case_				:  Union[str, Any]       =			"""speech-commands-v2-id2label.json"""
    else:
        snake_case_				:  List[Any]       =			527
        snake_case_				:  Union[str, Any]       =			"""audioset-id2label.json"""

    snake_case_				:  Optional[Any]       =			json.load(open(hf_hub_download(__A	,    __A	,    repo_type='''dataset'''					)	,    '''r'''					)					)
    snake_case_				:  int       =			{int(__A					): v for k, v in idalabel.items()}
    snake_case_				:  Any       =			idalabel
    snake_case_				:  List[str]       =			{v: k for k, v in idalabel.items()}

    return config




def __lowercase    (							_a					):
    if "module.v" in name:
        snake_case_				:  Dict       =			name.replace('''module.v'''	,    '''audio_spectrogram_transformer'''					)
    if "cls_token" in name:
        snake_case_				:  List[str]       =			name.replace('''cls_token'''	,    '''embeddings.cls_token'''					)
    if "dist_token" in name:
        snake_case_				:  int       =			name.replace('''dist_token'''	,    '''embeddings.distillation_token'''					)
    if "pos_embed" in name:
        snake_case_				:  str       =			name.replace('''pos_embed'''	,    '''embeddings.position_embeddings'''					)
    if "patch_embed.proj" in name:
        snake_case_				:  int       =			name.replace('''patch_embed.proj'''	,    '''embeddings.patch_embeddings.projection'''					)
    # transformer blocks
    if "blocks" in name:
        snake_case_				:  Any       =			name.replace('''blocks'''	,    '''encoder.layer'''					)
    if "attn.proj" in name:
        snake_case_				:  Union[str, Any]       =			name.replace('''attn.proj'''	,    '''attention.output.dense'''					)
    if "attn" in name:
        snake_case_				:  List[str]       =			name.replace('''attn'''	,    '''attention.self'''					)
    if "norm1" in name:
        snake_case_				:  Optional[Any]       =			name.replace('''norm1'''	,    '''layernorm_before'''					)
    if "norm2" in name:
        snake_case_				:  Any       =			name.replace('''norm2'''	,    '''layernorm_after'''					)
    if "mlp.fc1" in name:
        snake_case_				:  int       =			name.replace('''mlp.fc1'''	,    '''intermediate.dense'''					)
    if "mlp.fc2" in name:
        snake_case_				:  List[Any]       =			name.replace('''mlp.fc2'''	,    '''output.dense'''					)
    # final layernorm
    if "audio_spectrogram_transformer.norm" in name:
        snake_case_				:  str       =			name.replace('''audio_spectrogram_transformer.norm'''	,    '''audio_spectrogram_transformer.layernorm'''					)
    # classifier head
    if "module.mlp_head.0" in name:
        snake_case_				:  List[str]       =			name.replace('''module.mlp_head.0'''	,    '''classifier.layernorm'''					)
    if "module.mlp_head.1" in name:
        snake_case_				:  Optional[Any]       =			name.replace('''module.mlp_head.1'''	,    '''classifier.dense'''					)

    return name




def __lowercase    (							_a	,    _a					):
    for key in orig_state_dict.copy().keys():
        snake_case_				:  Dict       =			orig_state_dict.pop(__A					)

        if "qkv" in key:
            snake_case_				:  Tuple       =			key.split('''.'''					)
            snake_case_				:  int       =			int(key_split[3]					)
            snake_case_				:  Any       =			config.hidden_size
            if "weight" in key:
                snake_case_				:  Union[str, Any]       =			val[:dim, :]
                snake_case_				:  Union[str, Any]       =			val[dim : dim * 2, :]
                snake_case_				:  List[Any]       =			val[-dim:, :]
            else:
                snake_case_				:  Any       =			val[:dim]
                snake_case_				:  List[Any]       =			val[dim : dim * 2]
                snake_case_				:  Optional[Any]       =			val[-dim:]
        else:
            snake_case_				:  Dict       =			val

    return orig_state_dict




def __lowercase    (							_a					):
    snake_case_				:  Union[str, Any]       =			[
        """module.v.head.weight""",
        """module.v.head.bias""",
        """module.v.head_dist.weight""",
        """module.v.head_dist.bias""",
    ]
    for k in ignore_keys:
        state_dict.pop(__A	,    __A					)




@torch.no_grad()
def __lowercase    (							_a	,    _a	,    _a=False					):
    snake_case_				:  Union[str, Any]       =			get_audio_spectrogram_transformer_config(__A					)

    snake_case_				:  List[str]       =			{
        """ast-finetuned-audioset-10-10-0.4593""": (
            """https://www.dropbox.com/s/ca0b1v2nlxzyeb4/audioset_10_10_0.4593.pth?dl=1"""
        ),
        """ast-finetuned-audioset-10-10-0.450""": (
            """https://www.dropbox.com/s/1tv0hovue1bxupk/audioset_10_10_0.4495.pth?dl=1"""
        ),
        """ast-finetuned-audioset-10-10-0.448""": (
            """https://www.dropbox.com/s/6u5sikl4b9wo4u5/audioset_10_10_0.4483.pth?dl=1"""
        ),
        """ast-finetuned-audioset-10-10-0.448-v2""": (
            """https://www.dropbox.com/s/kt6i0v9fvfm1mbq/audioset_10_10_0.4475.pth?dl=1"""
        ),
        """ast-finetuned-audioset-12-12-0.447""": (
            """https://www.dropbox.com/s/snfhx3tizr4nuc8/audioset_12_12_0.4467.pth?dl=1"""
        ),
        """ast-finetuned-audioset-14-14-0.443""": (
            """https://www.dropbox.com/s/z18s6pemtnxm4k7/audioset_14_14_0.4431.pth?dl=1"""
        ),
        """ast-finetuned-audioset-16-16-0.442""": (
            """https://www.dropbox.com/s/mdsa4t1xmcimia6/audioset_16_16_0.4422.pth?dl=1"""
        ),
        """ast-finetuned-speech-commands-v2""": (
            """https://www.dropbox.com/s/q0tbqpwv44pquwy/speechcommands_10_10_0.9812.pth?dl=1"""
        ),
    }

    # load original state_dict
    snake_case_				:  List[Any]       =			model_name_to_url[model_name]
    snake_case_				:  Union[str, Any]       =			torch.hub.load_state_dict_from_url(__A	,    map_location='''cpu'''					)
    # remove some keys
    remove_keys(__A					)
    # rename some keys
    snake_case_				:  str       =			convert_state_dict(__A	,    __A					)

    # load 🤗 model
    snake_case_				:  Tuple       =			ASTForAudioClassification(__A					)
    model.eval()

    model.load_state_dict(__A					)

    # verify outputs on dummy input
    # source: https://github.com/YuanGongND/ast/blob/79e873b8a54d0a3b330dd522584ff2b9926cd581/src/run.py#L62
    snake_case_				:  Optional[int]       =			-4.267_7393 if """speech-commands""" not in model_name else -6.84_5978
    snake_case_				:  Dict       =			4.568_9974 if """speech-commands""" not in model_name else 5.565_4526
    snake_case_				:  int       =			1_024 if """speech-commands""" not in model_name else 128
    snake_case_				:  List[Any]       =			ASTFeatureExtractor(mean=__A	,    std=__A	,    max_length=__A					)

    if "speech-commands" in model_name:
        snake_case_				:  str       =			load_dataset('''speech_commands'''	,    '''v0.02'''	,    split='''validation'''					)
        snake_case_				:  List[str]       =			dataset[0]["""audio"""]["""array"""]
    else:
        snake_case_				:  Tuple       =			hf_hub_download(
            repo_id='''nielsr/audio-spectogram-transformer-checkpoint'''	,    filename='''sample_audio.flac'''	,    repo_type='''dataset'''	,    )

        snake_case_				:  Optional[Any]       =			torchaudio.load(__A					)
        snake_case_				:  int       =			waveform.squeeze().numpy()

    snake_case_				:  Optional[Any]       =			feature_extractor(__A	,    sampling_rate=16_000	,    return_tensors='''pt'''					)

    # forward pass
    snake_case_				:  Optional[int]       =			model(**__A					)
    snake_case_				:  Union[str, Any]       =			outputs.logits

    if model_name == "ast-finetuned-audioset-10-10-0.4593":
        snake_case_				:  Optional[Any]       =			torch.tensor([-0.8760, -7.0042, -8.6602]					)
    elif model_name == "ast-finetuned-audioset-10-10-0.450":
        snake_case_				:  Any       =			torch.tensor([-1.1986, -7.0903, -8.2718]					)
    elif model_name == "ast-finetuned-audioset-10-10-0.448":
        snake_case_				:  Tuple       =			torch.tensor([-2.6128, -8.0080, -9.4344]					)
    elif model_name == "ast-finetuned-audioset-10-10-0.448-v2":
        snake_case_				:  Any       =			torch.tensor([-1.5080, -7.4534, -8.8917]					)
    elif model_name == "ast-finetuned-audioset-12-12-0.447":
        snake_case_				:  Optional[Any]       =			torch.tensor([-0.5050, -6.5833, -8.0843]					)
    elif model_name == "ast-finetuned-audioset-14-14-0.443":
        snake_case_				:  Any       =			torch.tensor([-0.3826, -7.0336, -8.2413]					)
    elif model_name == "ast-finetuned-audioset-16-16-0.442":
        snake_case_				:  int       =			torch.tensor([-1.2113, -6.9101, -8.3470]					)
    elif model_name == "ast-finetuned-speech-commands-v2":
        snake_case_				:  Optional[Any]       =			torch.tensor([6.1589, -8.0566, -8.7984]					)
    else:
        raise ValueError('''Unknown model name'''					)
    if not torch.allclose(logits[0, :3]	,    __A	,    atol=1E-4					):
        raise ValueError('''Logits don\'t match'''					)
    print('''Looks ok!'''					)

    if pytorch_dump_folder_path is not None:
        Path(__A					).mkdir(exist_ok=__A					)
        print(f"Saving model {model_name} to {pytorch_dump_folder_path}"					)
        model.save_pretrained(__A					)
        print(f"Saving feature extractor to {pytorch_dump_folder_path}"					)
        feature_extractor.save_pretrained(__A					)

    if push_to_hub:
        print('''Pushing model and feature extractor to the hub...'''					)
        model.push_to_hub(f"MIT/{model_name}"					)
        feature_extractor.push_to_hub(f"MIT/{model_name}"					)


if __name__ == "__main__":
     lowercase__					:						int												=			argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         '''--model_name''',
         default='''ast-finetuned-audioset-10-10-0.4593''',
         type=str,
         help='''Name of the Audio Spectrogram Transformer model you\'d like to convert.''',
     )
     parser.add_argument(
         '''--pytorch_dump_folder_path''', default=None, type=str, help='''Path to the output PyTorch model directory.'''
     )
     parser.add_argument(
         '''--push_to_hub''', action='''store_true''', help='''Whether or not to push the converted model to the 🤗 hub.'''
     )

     lowercase__					:						Tuple												=			parser.parse_args()
     convert_audio_spectrogram_transformer_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)





"""simple docstring"""

from __future__ import annotations

import inspect
import unittest
from math import floor

import numpy as np

from transformers import CvtConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import TFCvtForImageClassification, TFCvtModel
     from transformers.models.cvt.modeling_tf_cvt import TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
     from PIL import Image

     from transformers import AutoImageProcessor




class  _UpperCAmelCase (    lowerCAmelCase__):

 def 		_snake_case      (  self	: int       ):
     snake_case_				:  Any       =			self.config_class(**self.inputs_dict       )
     self.parent.assertTrue(hasattr(lowercase_						,  '''embed_dim'''       )       )
     self.parent.assertTrue(hasattr(lowercase_						,  '''num_heads'''       )       )





class  _UpperCAmelCase :

 def __init__(  self	: List[str]						,  lowercase_	: Optional[Any]						,  lowercase_	: int=13						,  lowercase_	: Optional[int]=64						,  lowercase_	: Any=3						,  lowercase_	: Any=[16, 48, 96]						,  lowercase_	: List[Any]=[1, 3, 6]						,  lowercase_	: Union[str, Any]=[1, 2, 10]						,  lowercase_	: Optional[Any]=[7, 3, 3]						,  lowercase_	: Union[str, Any]=[4, 2, 2]						,  lowercase_	: Tuple=[2, 1, 1]						,  lowercase_	: List[str]=[2, 2, 2]						,  lowercase_	: Union[str, Any]=[False, False, True]						,  lowercase_	: Optional[int]=[0.0, 0.0, 0.0]						,  lowercase_	: str=0.02						,  lowercase_	: Optional[Any]=1E-12						,  lowercase_	: Optional[int]=True						,  lowercase_	: Optional[int]=True						,  lowercase_	: Optional[Any]=2						,  ):
     snake_case_				:  List[Any]       =			parent
     snake_case_				:  int       =			batch_size
     snake_case_				:  Union[str, Any]       =			image_size
     snake_case_				:  Tuple       =			patch_sizes
     snake_case_				:  List[Any]       =			patch_stride
     snake_case_				:  Dict       =			patch_padding
     snake_case_				:  Any       =			is_training
     snake_case_				:  Any       =			use_labels
     snake_case_				:  str       =			num_labels
     snake_case_				:  Optional[Any]       =			num_channels
     snake_case_				:  Optional[Any]       =			embed_dim
     snake_case_				:  int       =			num_heads
     snake_case_				:  List[str]       =			stride_kv
     snake_case_				:  Any       =			depth
     snake_case_				:  Dict       =			cls_token
     snake_case_				:  Dict       =			attention_drop_rate
     snake_case_				:  int       =			initializer_range
     snake_case_				:  Tuple       =			layer_norm_eps

 def 		_snake_case      (  self	: Dict       ):
     snake_case_				:  str       =			floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]       )

     snake_case_				:  str       =			None
     if self.use_labels:
         # create a random int32 tensor of given shape
         snake_case_				:  Union[str, Any]       =			ids_tensor([self.batch_size]						,  self.num_labels       )

     snake_case_				:  Dict       =			self.get_config()
     return config, pixel_values, labels

 def 		_snake_case      (  self	: int       ):
     return CvtConfig(
         image_size=self.image_size						,  num_labels=self.num_labels						,  num_channels=self.num_channels						,  embed_dim=self.embed_dim						,  num_heads=self.num_heads						,  patch_sizes=self.patch_sizes						,  patch_padding=self.patch_padding						,  patch_stride=self.patch_stride						,  stride_kv=self.stride_kv						,  depth=self.depth						,  cls_token=self.cls_token						,  attention_drop_rate=self.attention_drop_rate						,  initializer_range=self.initializer_range						,  )

 def 		_snake_case      (  self	: int						,  lowercase_	: List[str]						,  lowercase_	: Optional[Any]						,  lowercase_	: Union[str, Any]       ):
     snake_case_				:  Tuple       =			TFCvtModel(config=lowercase_       )
     snake_case_				:  Tuple       =			model(lowercase_						,  training=lowercase_       )
     snake_case_				:  int       =			(self.image_size, self.image_size)
     snake_case_,			snake_case_				:  List[str]       =			image_size[0], image_size[1]
     for i in range(len(self.depth       )       ):
         snake_case_				:  str       =			floor(((height + 2 * self.patch_padding[i] - self.patch_sizes[i]) / self.patch_stride[i]) + 1       )
         snake_case_				:  str       =			floor(((width + 2 * self.patch_padding[i] - self.patch_sizes[i]) / self.patch_stride[i]) + 1       )
     self.parent.assertEqual(result.last_hidden_state.shape						,  (self.batch_size, self.embed_dim[-1], height, width)       )

 def 		_snake_case      (  self	: Dict						,  lowercase_	: Tuple						,  lowercase_	: Union[str, Any]						,  lowercase_	: List[str]       ):
     snake_case_				:  int       =			self.num_labels
     snake_case_				:  Any       =			TFCvtForImageClassification(lowercase_       )
     snake_case_				:  List[Any]       =			model(lowercase_						,  labels=lowercase_						,  training=lowercase_       )
     self.parent.assertEqual(result.logits.shape						,  (self.batch_size, self.num_labels)       )






 def 		_snake_case      (  self	: Any       ):
     snake_case_				:  Tuple       =			self.prepare_config_and_inputs()
     snake_case_,			snake_case_,			snake_case_				:  List[str]       =			config_and_inputs
     snake_case_				:  Any       =			{'''pixel_values''': pixel_values}
     return config, inputs_dict





@require_tf
class  _UpperCAmelCase (    lowerCAmelCase__					,  lowerCAmelCase__					,  unittest.TestCase):
 _lowerCAmelCase     :    Optional[int]	      =	(TFCvtModel, TFCvtForImageClassification) if is_tf_available() else ()
 _lowerCAmelCase     :    str	      =	(
     {"""feature-extraction""": TFCvtModel, """image-classification""": TFCvtForImageClassification}
     if is_tf_available()
     else {}
 )
 _lowerCAmelCase     :    str	      =	False
 _lowerCAmelCase     :    int	      =	False
 _lowerCAmelCase     :    Tuple	      =	False
 _lowerCAmelCase     :    int	      =	False
 _lowerCAmelCase     :    int	      =	False

 def 		_snake_case      (  self	: int       ):
     snake_case_				:  Optional[int]       =			TFCvtModelTester(self       )
     snake_case_				:  str       =			TFCvtConfigTester(self						,  config_class=lowercase_						,  has_text_modality=lowercase_						,  hidden_size=37       )

 def 		_snake_case      (  self	: int       ):
     self.config_tester.create_and_test_config_common_properties()
     self.config_tester.create_and_test_config_to_json_string()
     self.config_tester.create_and_test_config_to_json_file()
     self.config_tester.create_and_test_config_from_and_save_pretrained()
     self.config_tester.create_and_test_config_with_num_labels()
     self.config_tester.check_config_can_be_init_without_params()
     self.config_tester.check_config_arguments_init()

 @unittest.skip(reason='''Cvt does not output attentions'''       )
 def 		_snake_case      (  self	: Any       ):
     pass

 @unittest.skip(reason='''Cvt does not use inputs_embeds'''       )
 def 		_snake_case      (  self	: str       ):
     pass

 @unittest.skip(reason='''Cvt does not support input and output embeddings'''       )
 def 		_snake_case      (  self	: Union[str, Any]       ):
     pass

 @unittest.skipIf(
     not is_tf_available() or len(tf.config.list_physical_devices('''GPU'''       )       ) == 0						,  reason='''TF does not support backprop for grouped convolutions on CPU.'''						,  )
 def 		_snake_case      (  self	: Tuple       ):
     super().test_dataset_conversion()

 @unittest.skipIf(
     not is_tf_available() or len(tf.config.list_physical_devices('''GPU'''       )       ) == 0						,  reason='''TF does not support backprop for grouped convolutions on CPU.'''						,  )
 @slow
 def 		_snake_case      (  self	: Tuple       ):
     super().test_keras_fit()

 @unittest.skip(reason='''Get `Failed to determine best cudnn convolution algo.` error after using TF 2.12+cuda 11.8'''       )
 def 		_snake_case      (  self	: List[str]       ):
     snake_case_				:  Optional[Any]       =			tf.keras.mixed_precision.Policy('''mixed_float16'''       )
     tf.keras.mixed_precision.set_global_policy(lowercase_       )
     super().test_keras_fit()
     tf.keras.mixed_precision.set_global_policy('''float32'''       )

 def 		_snake_case      (  self	: int       ):
     snake_case_,			snake_case_				:  List[str]       =			self.model_tester.prepare_config_and_inputs_for_common()

     for model_class in self.all_model_classes:
         snake_case_				:  Dict       =			model_class(lowercase_       )
         snake_case_				:  str       =			inspect.signature(model.call       )
         # signature.parameters is an OrderedDict => so arg_names order is deterministic
         snake_case_				:  List[str]       =			[*signature.parameters.keys()]

         snake_case_				:  int       =			['''pixel_values''']
         self.assertListEqual(arg_names[:1]						,  lowercase_       )

 def 		_snake_case      (  self	: List[str]       ):
     def check_hidden_states_output(lowercase_	: Optional[int]						,  lowercase_	: Union[str, Any]						,  lowercase_	: str       ):
         snake_case_				:  Any       =			model_class(lowercase_       )

         snake_case_				:  Optional[Any]       =			model(**self._prepare_for_class(lowercase_						,  lowercase_       )       )
         snake_case_				:  Tuple       =			outputs.hidden_states

         snake_case_				:  str       =			len(self.model_tester.depth       )
         self.assertEqual(len(lowercase_       )						,  lowercase_       )

         # verify the first hidden states (first block)
         self.assertListEqual(
             list(hidden_states[0].shape[-3:]       )						,  [
                 self.model_tester.embed_dim[0],
                 self.model_tester.image_size // 4,
                 self.model_tester.image_size // 4,
             ]						,  )

     snake_case_,			snake_case_				:  List[Any]       =			self.model_tester.prepare_config_and_inputs_for_common()

     for model_class in self.all_model_classes:
         snake_case_				:  Dict       =			True
         check_hidden_states_output(lowercase_						,  lowercase_						,  lowercase_       )

         # check that output_hidden_states also work using config
         del inputs_dict["output_hidden_states"]
         snake_case_				:  Tuple       =			True

         check_hidden_states_output(lowercase_						,  lowercase_						,  lowercase_       )

 def 		_snake_case      (  self	: str       ):
     snake_case_				:  Dict       =			self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_model(*lowercase_       )

 def 		_snake_case      (  self	: List[Any]       ):
     snake_case_				:  str       =			self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_image_classification(*lowercase_       )






 @slow
 def 		_snake_case      (  self	: Optional[Any]       ):
     for model_name in TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         snake_case_				:  int       =			TFCvtModel.from_pretrained(lowercase_       )
         self.assertIsNotNone(lowercase_       )





def __lowercase    (							):
    snake_case_				:  Tuple       =			Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''					)
    return image






@require_tf
@require_vision
class  _UpperCAmelCase (    unittest.TestCase):

 @cached_property
 def 		_snake_case      (  self	: List[Any]       ):
     return AutoImageProcessor.from_pretrained(TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST[0]       )






 @slow
 def 		_snake_case      (  self	: Tuple       ):
     snake_case_				:  int       =			TFCvtForImageClassification.from_pretrained(TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST[0]       )

     snake_case_				:  Any       =			self.default_image_processor
     snake_case_				:  Union[str, Any]       =			prepare_img()
     snake_case_				:  int       =			image_processor(images=lowercase_						,  return_tensors='''tf'''       )

     # forward pass
     snake_case_				:  Tuple       =			model(**lowercase_       )

     # verify the logits
     snake_case_				:  Optional[Any]       =			tf.TensorShape((1, 1000)       )
     self.assertEqual(outputs.logits.shape						,  lowercase_       )

     snake_case_				:  Tuple       =			tf.constant([0.92_85, 0.90_15, -0.31_50]       )
     self.assertTrue(np.allclose(outputs.logits[0, :3].numpy()						,  lowercase_						,  atol=1E-4       )       )





