

import argparse
import json

import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image

from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation






def     __lowercase					(   _A	)   ->  Optional[int]:
      SCREAMING_SNAKE_CASE       :					Union[str, Any]        =      384
      if "tiny" in model_name:
            SCREAMING_SNAKE_CASE       :					Optional[Any]        =      [3, 3, 9, 3]
            SCREAMING_SNAKE_CASE       :					Tuple        =      [96, 192, 384, 768]
      if "small" in model_name:
            SCREAMING_SNAKE_CASE       :					str        =      [3, 3, 27, 3]
            SCREAMING_SNAKE_CASE       :					str        =      [96, 192, 384, 768]
      if "base" in model_name:
            SCREAMING_SNAKE_CASE       :					str        =      [3, 3, 27, 3]
            SCREAMING_SNAKE_CASE       :					List[str]        =      [128, 256, 512, 1024]
            SCREAMING_SNAKE_CASE       :					Dict        =      512
      if "large" in model_name:
            SCREAMING_SNAKE_CASE       :					List[str]        =      [3, 3, 27, 3]
            SCREAMING_SNAKE_CASE       :					Dict        =      [192, 384, 768, 1536]
            SCREAMING_SNAKE_CASE       :					Union[str, Any]        =      768
      if "xlarge" in model_name:
            SCREAMING_SNAKE_CASE       :					Any        =      [3, 3, 27, 3]
            SCREAMING_SNAKE_CASE       :					str        =      [256, 512, 1024, 2048]
            SCREAMING_SNAKE_CASE       :					str        =      1024

      # set label information
      SCREAMING_SNAKE_CASE       :					Optional[Any]        =      150
      SCREAMING_SNAKE_CASE       :					int        =      '''huggingface/label-files'''
      SCREAMING_SNAKE_CASE       :					str        =      '''ade20k-id2label.json'''
      SCREAMING_SNAKE_CASE       :					Tuple        =      json.load(open(hf_hub_download(lowercase__  ,			lowercase__  ,			repo_type="""dataset"""	)  ,			"""r"""	)	)
      SCREAMING_SNAKE_CASE       :					str        =      {int(lowercase__	): v for k, v in idalabel.items()}
      SCREAMING_SNAKE_CASE       :					List[Any]        =      {v: k for k, v in idalabel.items()}

      SCREAMING_SNAKE_CASE       :					str        =      ConvNextConfig(
          depths=lowercase__  ,			hidden_sizes=lowercase__  ,			out_features=["""stage1""", """stage2""", """stage3""", """stage4"""]	)
      SCREAMING_SNAKE_CASE       :					List[Any]        =      UperNetConfig(
          backbone_config=lowercase__  ,			auxiliary_in_channels=lowercase__  ,			num_labels=lowercase__  ,			idalabel=lowercase__  ,			labelaid=lowercase__  ,			)

      return config






def     __lowercase					(   _A	)   ->  int:
      SCREAMING_SNAKE_CASE       :					Optional[Any]        =      []

      # fmt: off
      # stem
      rename_keys.append(("""backbone.downsample_layers.0.0.weight""", """backbone.embeddings.patch_embeddings.weight""")	)
      rename_keys.append(("""backbone.downsample_layers.0.0.bias""", """backbone.embeddings.patch_embeddings.bias""")	)
      rename_keys.append(("""backbone.downsample_layers.0.1.weight""", """backbone.embeddings.layernorm.weight""")	)
      rename_keys.append(("""backbone.downsample_layers.0.1.bias""", """backbone.embeddings.layernorm.bias""")	)
      # stages
      for i in range(len(config.backbone_config.depths	)	):
            for j in range(config.backbone_config.depths[i]	):
                  rename_keys.append((F"backbone.stages.{i}.{j}.gamma", F"backbone.encoder.stages.{i}.layers.{j}.layer_scale_parameter")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.depthwise_conv.weight", F"backbone.encoder.stages.{i}.layers.{j}.dwconv.weight")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.depthwise_conv.bias", F"backbone.encoder.stages.{i}.layers.{j}.dwconv.bias")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.norm.weight", F"backbone.encoder.stages.{i}.layers.{j}.layernorm.weight")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.norm.bias", F"backbone.encoder.stages.{i}.layers.{j}.layernorm.bias")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.pointwise_conv1.weight", F"backbone.encoder.stages.{i}.layers.{j}.pwconv1.weight")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.pointwise_conv1.bias", F"backbone.encoder.stages.{i}.layers.{j}.pwconv1.bias")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.pointwise_conv2.weight", F"backbone.encoder.stages.{i}.layers.{j}.pwconv2.weight")	)
                  rename_keys.append((F"backbone.stages.{i}.{j}.pointwise_conv2.bias", F"backbone.encoder.stages.{i}.layers.{j}.pwconv2.bias")	)
            if i > 0:
                  rename_keys.append((F"backbone.downsample_layers.{i}.0.weight", F"backbone.encoder.stages.{i}.downsampling_layer.0.weight")	)
                  rename_keys.append((F"backbone.downsample_layers.{i}.0.bias", F"backbone.encoder.stages.{i}.downsampling_layer.0.bias")	)
                  rename_keys.append((F"backbone.downsample_layers.{i}.1.weight", F"backbone.encoder.stages.{i}.downsampling_layer.1.weight")	)
                  rename_keys.append((F"backbone.downsample_layers.{i}.1.bias", F"backbone.encoder.stages.{i}.downsampling_layer.1.bias")	)

            rename_keys.append((F"backbone.norm{i}.weight", F"backbone.hidden_states_norms.stage{i+1}.weight")	)
            rename_keys.append((F"backbone.norm{i}.bias", F"backbone.hidden_states_norms.stage{i+1}.bias")	)

      # decode head
      rename_keys.extend(
          [
              ("""decode_head.conv_seg.weight""", """decode_head.classifier.weight"""),
              ("""decode_head.conv_seg.bias""", """decode_head.classifier.bias"""),
              ("""auxiliary_head.conv_seg.weight""", """auxiliary_head.classifier.weight"""),
              ("""auxiliary_head.conv_seg.bias""", """auxiliary_head.classifier.bias"""),
          ]	)
      # fmt: on

      return rename_keys






def     __lowercase					(   _A  ,			_A  ,			_A	)   ->  Optional[int]:
      SCREAMING_SNAKE_CASE       :					Optional[Any]        =      dct.pop(lowercase__	)
      SCREAMING_SNAKE_CASE       :					List[str]        =      val






def     __lowercase					(   _A  ,			_A  ,			_A	)   ->  int:
      SCREAMING_SNAKE_CASE       :					Dict        =      {
          '''upernet-convnext-tiny''': '''https://download.openmmlab.com/mmsegmentation/v0.5/convnext/upernet_convnext_tiny_fp16_512x512_160k_ade20k/upernet_convnext_tiny_fp16_512x512_160k_ade20k_20220227_124553-cad485de.pth''',
          '''upernet-convnext-small''': '''https://download.openmmlab.com/mmsegmentation/v0.5/convnext/upernet_convnext_small_fp16_512x512_160k_ade20k/upernet_convnext_small_fp16_512x512_160k_ade20k_20220227_131208-1b1e394f.pth''',
          '''upernet-convnext-base''': '''https://download.openmmlab.com/mmsegmentation/v0.5/convnext/upernet_convnext_base_fp16_512x512_160k_ade20k/upernet_convnext_base_fp16_512x512_160k_ade20k_20220227_181227-02a24fc6.pth''',
          '''upernet-convnext-large''': '''https://download.openmmlab.com/mmsegmentation/v0.5/convnext/upernet_convnext_large_fp16_640x640_160k_ade20k/upernet_convnext_large_fp16_640x640_160k_ade20k_20220226_040532-e57aa54d.pth''',
          '''upernet-convnext-xlarge''': '''https://download.openmmlab.com/mmsegmentation/v0.5/convnext/upernet_convnext_xlarge_fp16_640x640_160k_ade20k/upernet_convnext_xlarge_fp16_640x640_160k_ade20k_20220226_080344-95fc38c2.pth''',
      }
      SCREAMING_SNAKE_CASE       :					str        =      model_name_to_url[model_name]
      SCREAMING_SNAKE_CASE       :					Tuple        =      torch.hub.load_state_dict_from_url(lowercase__  ,			map_location="""cpu"""	)['''state_dict''']

      SCREAMING_SNAKE_CASE       :					Optional[int]        =      get_upernet_config(lowercase__	)
      SCREAMING_SNAKE_CASE       :					List[Any]        =      UperNetForSemanticSegmentation(lowercase__	)
      model.eval()

      # replace "bn" => "batch_norm"
      for key in state_dict.copy().keys():
            SCREAMING_SNAKE_CASE       :					str        =      state_dict.pop(lowercase__	)
            if "bn" in key:
                  SCREAMING_SNAKE_CASE       :					Tuple        =      key.replace("""bn"""  ,			"""batch_norm"""	)
            SCREAMING_SNAKE_CASE       :					Dict        =      val

      # rename keys
      SCREAMING_SNAKE_CASE       :					Tuple        =      create_rename_keys(lowercase__	)
      for src, dest in rename_keys:
            rename_key(lowercase__  ,			lowercase__  ,			lowercase__	)

      model.load_state_dict(lowercase__	)

      # verify on image
      SCREAMING_SNAKE_CASE       :					Dict        =      '''https://huggingface.co/datasets/hf-internal-testing/fixtures_ade20k/resolve/main/ADE_val_00000001.jpg'''
      SCREAMING_SNAKE_CASE       :					Optional[int]        =      Image.open(requests.get(lowercase__  ,			stream=lowercase__	).raw	).convert("""RGB"""	)

      SCREAMING_SNAKE_CASE       :					Optional[int]        =      SegformerImageProcessor()
      SCREAMING_SNAKE_CASE       :					List[str]        =      processor(lowercase__  ,			return_tensors="""pt"""	).pixel_values

      with torch.no_grad():
            SCREAMING_SNAKE_CASE       :					int        =      model(lowercase__	)

      if model_name == "upernet-convnext-tiny":
            SCREAMING_SNAKE_CASE       :					str        =      torch.tensor(
                [[-8.8110, -8.8110, -8.6521], [-8.8110, -8.8110, -8.6521], [-8.7746, -8.7746, -8.6130]]	)
      elif model_name == "upernet-convnext-small":
            SCREAMING_SNAKE_CASE       :					List[str]        =      torch.tensor(
                [[-8.8236, -8.8236, -8.6771], [-8.8236, -8.8236, -8.6771], [-8.7638, -8.7638, -8.6240]]	)
      elif model_name == "upernet-convnext-base":
            SCREAMING_SNAKE_CASE       :					Optional[Any]        =      torch.tensor(
                [[-8.8558, -8.8558, -8.6905], [-8.8558, -8.8558, -8.6905], [-8.7669, -8.7669, -8.6021]]	)
      elif model_name == "upernet-convnext-large":
            SCREAMING_SNAKE_CASE       :					int        =      torch.tensor(
                [[-8.6660, -8.6660, -8.6210], [-8.6660, -8.6660, -8.6210], [-8.6310, -8.6310, -8.5964]]	)
      elif model_name == "upernet-convnext-xlarge":
            SCREAMING_SNAKE_CASE       :					List[Any]        =      torch.tensor(
                [[-8.4980, -8.4980, -8.3977], [-8.4980, -8.4980, -8.3977], [-8.4379, -8.4379, -8.3412]]	)
      print("""Logits:"""  ,			outputs.logits[0, 0, :3, :3]	)
      assert torch.allclose(outputs.logits[0, 0, :3, :3]  ,			lowercase__  ,			atol=1e-4	)
      print("""Looks ok!"""	)

      if pytorch_dump_folder_path is not None:
            print(F"Saving model {model_name} to {pytorch_dump_folder_path}"	)
            model.save_pretrained(lowercase__	)
            print(F"Saving processor to {pytorch_dump_folder_path}"	)
            processor.save_pretrained(lowercase__	)

      if push_to_hub:
            print(F"Pushing model and processor for {model_name} to hub"	)
            model.push_to_hub(F"openmmlab/{model_name}"	)
            processor.push_to_hub(F"openmmlab/{model_name}"	)


if __name__ == "__main__":
  UpperCAmelCase__       :   int 			=			argparse.ArgumentParser()
  # Required parameters
  parser.add_argument(
      """--model_name""",
      default="""upernet-convnext-tiny""",
      type=str,
      choices=[F"""upernet-convnext-{size}""" for size in ["""tiny""", """small""", """base""", """large""", """xlarge"""]],
      help="""Name of the ConvNext UperNet 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."""
  )

  UpperCAmelCase__       :   int 			=			parser.parse_args()
  convert_upernet_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)







import itertools
import random
import unittest

import numpy as np

from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor
from transformers.testing_utils import require_torch, slow

from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin


_UpperCamelCase 			=		random.Random()







def 		_lowercase (     lowercase__   ,	lowercase__=1.0   ,	lowercase__=None   ,	lowercase__=None						):
      if rng is None:
            __lowerCAmelCase					:						Optional[Any]					=					global_rng

      __lowerCAmelCase					:						Tuple					=					[]
      for batch_idx in range(shape[0]						):
            values.append([]						)
            for _ in range(shape[1]						):
                  values[-1].append(rng.random() * scale						)

      return values







class   __lowercase      (unittest.TestCase ):
 def __init__(							self      ,							A_      ,							A_=7      ,							A_=400      ,							A_=2000      ,							A_=1      ,							A_=0.0      ,							A_=1_6000      ,							A_=True      ,							A_=True      ,							)					->List[Any]:



       '''simple docstring'''





       __lowerCAmelCase					:						List[Any]					=					parent
       __lowerCAmelCase					:						Optional[int]					=					batch_size
       __lowerCAmelCase					:						Any					=					min_seq_length
       __lowerCAmelCase					:						Tuple					=					max_seq_length
       __lowerCAmelCase					:						Tuple					=					(self.max_seq_length - self.min_seq_length) // (self.batch_size - 1)
       __lowerCAmelCase					:						Dict					=					feature_size
       __lowerCAmelCase					:						Optional[int]					=					padding_value
       __lowerCAmelCase					:						Tuple					=					sampling_rate
       __lowerCAmelCase					:						Union[str, Any]					=					return_attention_mask
       __lowerCAmelCase					:						Dict					=					do_normalize
 def 	UpperCamelCase__  (							self					)					->Optional[Any]:



       '''simple docstring'''





       return {
           "feature_size": self.feature_size,
           "padding_value": self.padding_value,
           "sampling_rate": self.sampling_rate,
           "return_attention_mask": self.return_attention_mask,
           "do_normalize": self.do_normalize,
       }





 def 	UpperCamelCase__  (							self      ,							A_=False      ,							A_=False					)					->Union[str, Any]:



       '''simple docstring'''





       def _flatten(A_					):
             return list(itertools.chain(*A_					)					)

       if equal_length:
             __lowerCAmelCase					:						Dict					=					floats_list((self.batch_size, self.max_seq_length)					)
       else:
             # make sure that inputs increase in size
             __lowerCAmelCase					:						Tuple					=					[
                 _flatten(floats_list((x, self.feature_size)					)					)
                 for x in range(self.min_seq_length      ,							self.max_seq_length      ,							self.seq_length_diff					)
             ]

       if numpify:
             __lowerCAmelCase					:						Tuple					=					[np.asarray(A_					) for x in speech_inputs]

       return speech_inputs







class   __lowercase      (_UpperCAmelCase		,   unittest.TestCase ):
 _UpperCamelCase			  =  WavaVecaFeatureExtractor
 def 	UpperCamelCase__  (							self					)					->Dict:



       '''simple docstring'''





       __lowerCAmelCase					:						List[Any]					=					WavaVecaFeatureExtractionTester(self					)
 def 	UpperCamelCase__  (							self      ,							A_					)					->Optional[Any]:



       '''simple docstring'''





       self.assertTrue(np.all(np.mean(A_      ,							axis=0					) < 1e-3					)					)
       self.assertTrue(np.all(np.abs(np.var(A_      ,							axis=0					) - 1					) < 1e-3					)					)
 def 	UpperCamelCase__  (							self					)					->Tuple:



       '''simple docstring'''





       __lowerCAmelCase					:						List[str]					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       # create three inputs of length 800, 1000, and 1200
       __lowerCAmelCase					:						Optional[Any]					=					[floats_list((1, x)					)[0] for x in range(800      ,							1400      ,							200					)]
       __lowerCAmelCase					:						Any					=					[np.asarray(A_					) for speech_input in speech_inputs]

       # Test not batched input
       __lowerCAmelCase					:						Optional[Any]					=					feat_extract(speech_inputs[0]      ,							return_tensors='''np'''					).input_values
       __lowerCAmelCase					:						Dict					=					feat_extract(np_speech_inputs[0]      ,							return_tensors='''np'''					).input_values
       self.assertTrue(np.allclose(A_      ,							A_      ,							atol=1e-3					)					)

       # Test batched
       __lowerCAmelCase					:						Dict					=					feat_extract(A_      ,							return_tensors='''np'''					).input_values
       __lowerCAmelCase					:						Dict					=					feat_extract(A_      ,							return_tensors='''np'''					).input_values
       for enc_seq_a, enc_seq_a in zip(A_      ,							A_					):
             self.assertTrue(np.allclose(A_      ,							A_      ,							atol=1e-3					)					)

       # Test 2-D numpy arrays are batched.
       __lowerCAmelCase					:						int					=					[floats_list((1, x)					)[0] for x in (800, 800, 800)]
       __lowerCAmelCase					:						List[Any]					=					np.asarray(A_					)
       __lowerCAmelCase					:						Any					=					feat_extract(A_      ,							return_tensors='''np'''					).input_values
       __lowerCAmelCase					:						Union[str, Any]					=					feat_extract(A_      ,							return_tensors='''np'''					).input_values
       for enc_seq_a, enc_seq_a in zip(A_      ,							A_					):
             self.assertTrue(np.allclose(A_      ,							A_      ,							atol=1e-3					)					)
 def 	UpperCamelCase__  (							self					)					->Union[str, Any]:



       '''simple docstring'''





       __lowerCAmelCase					:						Optional[int]					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       __lowerCAmelCase					:						str					=					[floats_list((1, x)					)[0] for x in range(800      ,							1400      ,							200					)]

       __lowerCAmelCase					:						str					=					['''longest''', '''max_length''', '''do_not_pad''']
       __lowerCAmelCase					:						str					=					[None, 1600, None]
       for max_length, padding in zip(A_      ,							A_					):
             __lowerCAmelCase					:						Optional[int]					=					feat_extract(A_      ,							padding=A_      ,							max_length=A_      ,							return_tensors='''np'''					)
             __lowerCAmelCase					:						Optional[Any]					=					processed.input_values

             self._check_zero_mean_unit_variance(input_values[0][:800]					)
             self.assertTrue(input_values[0][800:].sum() < 1e-6					)
             self._check_zero_mean_unit_variance(input_values[1][:1000]					)
             self.assertTrue(input_values[0][1000:].sum() < 1e-6					)
             self._check_zero_mean_unit_variance(input_values[2][:1200]					)
 def 	UpperCamelCase__  (							self					)					->Dict:



       '''simple docstring'''





       __lowerCAmelCase					:						List[str]					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       __lowerCAmelCase					:						Optional[int]					=					range(800      ,							1400      ,							200					)
       __lowerCAmelCase					:						Union[str, Any]					=					[floats_list((1, x)					)[0] for x in lengths]

       __lowerCAmelCase					:						int					=					['''longest''', '''max_length''', '''do_not_pad''']
       __lowerCAmelCase					:						List[str]					=					[None, 1600, None]

       for max_length, padding in zip(A_      ,							A_					):
             __lowerCAmelCase					:						Union[str, Any]					=					feat_extract(A_      ,							max_length=A_      ,							padding=A_					)
             __lowerCAmelCase					:						Union[str, Any]					=					processed.input_values

             self._check_zero_mean_unit_variance(input_values[0][:800]					)
             self._check_zero_mean_unit_variance(input_values[1][:1000]					)
             self._check_zero_mean_unit_variance(input_values[2][:1200]					)
 def 	UpperCamelCase__  (							self					)					->Tuple:



       '''simple docstring'''





       __lowerCAmelCase					:						Dict					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       __lowerCAmelCase					:						Optional[Any]					=					[floats_list((1, x)					)[0] for x in range(800      ,							1400      ,							200					)]
       __lowerCAmelCase					:						List[str]					=					feat_extract(
           A_      ,							truncation=A_      ,							max_length=1000      ,							padding='''max_length'''      ,							return_tensors='''np'''					)
       __lowerCAmelCase					:						int					=					processed.input_values

       self._check_zero_mean_unit_variance(input_values[0, :800]					)
       self._check_zero_mean_unit_variance(input_values[1]					)
       self._check_zero_mean_unit_variance(input_values[2]					)
 def 	UpperCamelCase__  (							self					)					->List[str]:



       '''simple docstring'''





       __lowerCAmelCase					:						Dict					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       __lowerCAmelCase					:						int					=					[floats_list((1, x)					)[0] for x in range(800      ,							1400      ,							200					)]
       __lowerCAmelCase					:						int					=					feat_extract(
           A_      ,							truncation=A_      ,							max_length=1000      ,							padding='''longest'''      ,							return_tensors='''np'''					)
       __lowerCAmelCase					:						Optional[Any]					=					processed.input_values

       self._check_zero_mean_unit_variance(input_values[0, :800]					)
       self._check_zero_mean_unit_variance(input_values[1, :1000]					)
       self._check_zero_mean_unit_variance(input_values[2]					)

       # make sure that if max_length < longest -> then pad to max_length
       self.assertTrue(input_values.shape == (3, 1000)					)

       __lowerCAmelCase					:						Any					=					[floats_list((1, x)					)[0] for x in range(800      ,							1400      ,							200					)]
       __lowerCAmelCase					:						Optional[int]					=					feat_extract(
           A_      ,							truncation=A_      ,							max_length=2000      ,							padding='''longest'''      ,							return_tensors='''np'''					)
       __lowerCAmelCase					:						List[str]					=					processed.input_values

       self._check_zero_mean_unit_variance(input_values[0, :800]					)
       self._check_zero_mean_unit_variance(input_values[1, :1000]					)
       self._check_zero_mean_unit_variance(input_values[2]					)

       # make sure that if max_length > longest -> then pad to longest
       self.assertTrue(input_values.shape == (3, 1200)					)
 @require_torch
 def 	UpperCamelCase__  (							self					)					->Any:



       '''simple docstring'''





       import torch

       __lowerCAmelCase					:						Union[str, Any]					=					self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()					)
       __lowerCAmelCase					:						Any					=					np.random.rand(100					).astype(np.floataa					)
       __lowerCAmelCase					:						List[Any]					=					np_speech_inputs.tolist()

       for inputs in [py_speech_inputs, np_speech_inputs]:
             __lowerCAmelCase					:						Any					=					feature_extractor.pad([{'''input_values''': inputs}]      ,							return_tensors='''np'''					)
             self.assertTrue(np_processed.input_values.dtype == np.floataa					)
             __lowerCAmelCase					:						List[str]					=					feature_extractor.pad([{'''input_values''': inputs}]      ,							return_tensors='''pt'''					)
             self.assertTrue(pt_processed.input_values.dtype == torch.floataa					)





 @slow
 @require_torch
 def 	UpperCamelCase__  (							self					)					->int:



       '''simple docstring'''





       for model_id in WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST:
             __lowerCAmelCase					:						Any					=					WavaVecaConfig.from_pretrained(A_					)
             __lowerCAmelCase					:						Tuple					=					WavaVecaFeatureExtractor.from_pretrained(A_					)

             # only "layer" feature extraction norm should make use of
             # attention_mask
             self.assertEqual(feat_extract.return_attention_mask      ,							config.feat_extract_norm == '''layer'''					)


