

import argparse
import math
import os
from copy import deepcopy

import torch
from audio_diffusion.models import DiffusionAttnUnetaD
from diffusion import sampling
from torch import nn

from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel


__UpperCAmelCase								=			{
    """gwf-440k""": {
        """url""": """https://model-server.zqevans2.workers.dev/gwf-440k.ckpt""",
        """sample_rate""": 48_000,
        """sample_size""": 65_536,
    },
    """jmann-small-190k""": {
        """url""": """https://model-server.zqevans2.workers.dev/jmann-small-190k.ckpt""",
        """sample_rate""": 48_000,
        """sample_size""": 65_536,
    },
    """jmann-large-580k""": {
        """url""": """https://model-server.zqevans2.workers.dev/jmann-large-580k.ckpt""",
        """sample_rate""": 48_000,
        """sample_size""": 131_072,
    },
    """maestro-uncond-150k""": {
        """url""": """https://model-server.zqevans2.workers.dev/maestro-uncond-150k.ckpt""",
        """sample_rate""": 16_000,
        """sample_size""": 65_536,
    },
    """unlocked-uncond-250k""": {
        """url""": """https://model-server.zqevans2.workers.dev/unlocked-uncond-250k.ckpt""",
        """sample_rate""": 16_000,
        """sample_size""": 65_536,
    },
    """honk-140k""": {
        """url""": """https://model-server.zqevans2.workers.dev/honk-140k.ckpt""",
        """sample_rate""": 16_000,
        """sample_size""": 65_536,
    },
}





def      snake_case_				(__A					:						Union[str, Any] ,       __A					:						Dict					)      ->     List[str]:
   return torch.atana(__A ,       __A					) / math.pi * 2





def      snake_case_				(__A					:						int					)      ->     Any:
   __lowerCAmelCase  :      Optional[int]    =						torch.sin(t * math.pi / 2					) ** 2
   __lowerCAmelCase  :      Optional[Any]    =						(1 - sigma**2) ** 0.5
   return alpha_sigma_to_t(__A ,       __A					)



class SCREAMING_SNAKE_CASE     (  a_			):
  """simple docstring"""






  pass






class SCREAMING_SNAKE_CASE     (  nn.Module			):
  """simple docstring"""






  def __init__(      self			:   Optional[int]	,							lowerCAmelCase			:   List[Any]   )							->     List[Any]:






     """simple docstring"""







     super().__init__()

     __lowerCAmelCase  :      List[Any]    =						DiffusionAttnUnetaD(lowerCAmelCase	,							n_attn_layers=4   )
     __lowerCAmelCase  :      Optional[Any]    =						deepcopy(self.diffusion   )
     __lowerCAmelCase  :      Tuple    =						torch.quasirandom.SobolEngine(1	,							scramble=lowerCAmelCase   )






def      snake_case_				(__A					:						Dict					)      ->     Any:
   __lowerCAmelCase  :      str    =						MODELS_MAP[model_name]["""url"""]
   os.system(f'''wget {url} ./'''					)

   return f'''./{model_name}.ckpt'''


__UpperCAmelCase								=			{
    """1""": """resnets.0""",
    """2""": """attentions.0""",
    """3""": """resnets.1""",
    """4""": """attentions.1""",
    """5""": """resnets.2""",
    """6""": """attentions.2""",
}
__UpperCAmelCase								=			{
    """8""": """resnets.0""",
    """9""": """attentions.0""",
    """10""": """resnets.1""",
    """11""": """attentions.1""",
    """12""": """resnets.2""",
    """13""": """attentions.2""",
}
__UpperCAmelCase								=			{
    """1""": """resnets.0""",
    """2""": """attentions.0""",
    """3""": """resnets.1""",
    """4""": """attentions.1""",
    """5""": """resnets.2""",
    """6""": """attentions.2""",
    """8""": """resnets.3""",
    """9""": """attentions.3""",
    """10""": """resnets.4""",
    """11""": """attentions.4""",
    """12""": """resnets.5""",
    """13""": """attentions.5""",
}
__UpperCAmelCase								=			{
    """0""": """resnets.0""",
    """1""": """resnets.1""",
    """2""": """resnets.2""",
    """4""": """resnets.0""",
    """5""": """resnets.1""",
    """6""": """resnets.2""",
}

__UpperCAmelCase								=			{
    """skip""": """conv_skip""",
    """main.0""": """conv_1""",
    """main.1""": """group_norm_1""",
    """main.3""": """conv_2""",
    """main.4""": """group_norm_2""",
}

__UpperCAmelCase								=			{
    """norm""": """group_norm""",
    """qkv_proj""": ["""query""", """key""", """value"""],
    """out_proj""": ["""proj_attn"""],
}





def      snake_case_				(__A					:						int					)      ->     Optional[int]:
   if name.startswith("""skip"""					):
      return name.replace("""skip""" ,       RES_CONV_MAP["""skip"""]					)

   # name has to be of format main.{digit}
   if not name.startswith("""main."""					):
      raise ValueError(f'''ResConvBlock error with {name}'''					)

   return name.replace(name[:6] ,       RES_CONV_MAP[name[:6]]					)





def      snake_case_				(__A					:						int					)      ->     int:
   for key, value in ATTN_MAP.items():
      if name.startswith(__A					) and not isinstance(__A ,       __A					):
         return name.replace(__A ,       __A					)
      elif name.startswith(__A					):
         return [name.replace(__A ,       __A					) for v in value]
   raise ValueError(f'''Attn error with {name}'''					)





def      snake_case_				(__A					:						Any ,       __A					:						Optional[Any]=1_3					)      ->     Union[str, Any]:
   __lowerCAmelCase  :      List[str]    =						input_string

   if string.split("""."""					)[0] == "timestep_embed":
      return string.replace("""timestep_embed""" ,       """time_proj"""					)

   __lowerCAmelCase  :      Union[str, Any]    =						0
   if string.startswith("""net.3."""					):
      depth += 1
      __lowerCAmelCase  :      Optional[Any]    =						string[6:]
   elif string.startswith("""net."""					):
      __lowerCAmelCase  :      Dict    =						string[4:]

   while string.startswith("""main.7."""					):
      depth += 1
      __lowerCAmelCase  :      str    =						string[7:]

   if string.startswith("""main."""					):
      __lowerCAmelCase  :      Dict    =						string[5:]

   # mid block
   if string[:2].isdigit():
      __lowerCAmelCase  :      Tuple    =						string[:2]
      __lowerCAmelCase  :      Union[str, Any]    =						string[2:]
   else:
      __lowerCAmelCase  :      Optional[int]    =						string[0]
      __lowerCAmelCase  :      Tuple    =						string[1:]

   if depth == max_depth:
      __lowerCAmelCase  :      List[str]    =						MID_NUM_TO_LAYER[layer_num]
      __lowerCAmelCase  :      Optional[Any]    =						"""mid_block"""
   elif depth > 0 and int(__A					) < 7:
      __lowerCAmelCase  :      Union[str, Any]    =						DOWN_NUM_TO_LAYER[layer_num]
      __lowerCAmelCase  :      Optional[int]    =						f'''down_blocks.{depth}'''
   elif depth > 0 and int(__A					) > 7:
      __lowerCAmelCase  :      Optional[int]    =						UP_NUM_TO_LAYER[layer_num]
      __lowerCAmelCase  :      Union[str, Any]    =						f'''up_blocks.{max_depth - depth - 1}'''
   elif depth == 0:
      __lowerCAmelCase  :      Optional[int]    =						DEPTH_0_TO_LAYER[layer_num]
      __lowerCAmelCase  :      Optional[Any]    =						f'''up_blocks.{max_depth - 1}''' if int(__A					) > 3 else """down_blocks.0"""

   if not string_left.startswith("""."""					):
      raise ValueError(f'''Naming error with {input_string} and string_left: {string_left}.'''					)

   __lowerCAmelCase  :      Optional[int]    =						string_left[1:]

   if "resnets" in new_layer:
      __lowerCAmelCase  :      Any    =						convert_resconv_naming(__A					)
   elif "attentions" in new_layer:
      __lowerCAmelCase  :      Optional[Any]    =						convert_attn_naming(__A					)
      __lowerCAmelCase  :      Tuple    =						new_string_left

   if not isinstance(__A ,       __A					):
      __lowerCAmelCase  :      Optional[Any]    =						prefix + """.""" + new_layer + """.""" + string_left
   else:
      __lowerCAmelCase  :      Optional[Any]    =						[prefix + """.""" + new_layer + """.""" + s for s in string_left]
   return new_string





def      snake_case_				(__A					:						List[str]					)      ->     Union[str, Any]:
   __lowerCAmelCase  :      List[str]    =						{}
   for k, v in state_dict.items():
      if k.endswith("""kernel"""					):
         # up- and downsample layers, don't have trainable weights
         continue

      __lowerCAmelCase  :      Union[str, Any]    =						rename(__A					)

      # check if we need to transform from Conv => Linear for attention
      if isinstance(__A ,       __A					):
         __lowerCAmelCase  :      Tuple    =						transform_conv_attns(__A ,       __A ,       __A					)
      else:
         __lowerCAmelCase  :      Union[str, Any]    =						v

   return new_state_dict





def      snake_case_				(__A					:						Dict ,       __A					:						Tuple ,       __A					:						Tuple					)      ->     str:
   if len(__A					) == 1:
      if len(v.shape					) == 3:
         # weight
         __lowerCAmelCase  :      Union[str, Any]    =						v[:, :, 0]
      else:
         # bias
         __lowerCAmelCase  :      Dict    =						v
   else:
      # qkv matrices
      __lowerCAmelCase  :      Any    =						v.shape[0]
      __lowerCAmelCase  :      List[str]    =						trippled_shape // 3
      for i in range(3					):
         if len(v.shape					) == 3:
            __lowerCAmelCase  :      str    =						v[i * single_shape : (i + 1) * single_shape, :, 0]
         else:
            __lowerCAmelCase  :      Optional[int]    =						v[i * single_shape : (i + 1) * single_shape]
   return new_state_dict





def      snake_case_				(__A					:						Tuple					)      ->     Union[str, Any]:
   __lowerCAmelCase  :      Any    =						torch.device("""cuda""" if torch.cuda.is_available() else """cpu"""					)

   __lowerCAmelCase  :      Dict    =						args.model_path.split("""/"""					)[-1].split("""."""					)[0]
   if not os.path.isfile(args.model_path					):
      assert (
          model_name == args.model_path
      ), f'''Make sure to provide one of the official model names {MODELS_MAP.keys()}'''
      __lowerCAmelCase  :      Tuple    =						download(__A					)

   __lowerCAmelCase  :      Optional[int]    =						MODELS_MAP[model_name]["""sample_rate"""]
   __lowerCAmelCase  :      Tuple    =						MODELS_MAP[model_name]["""sample_size"""]

   __lowerCAmelCase  :      Dict    =						Object()
   __lowerCAmelCase  :      List[Any]    =						sample_size
   __lowerCAmelCase  :      Optional[int]    =						sample_rate
   __lowerCAmelCase  :      Tuple    =						0

   __lowerCAmelCase  :      Any    =						UNetaDModel(sample_size=__A ,       sample_rate=__A					)
   __lowerCAmelCase  :      Dict    =						diffusers_model.state_dict()

   __lowerCAmelCase  :      Any    =						DiffusionUncond(__A					)
   orig_model.load_state_dict(torch.load(args.model_path ,       map_location=__A					)["""state_dict"""]					)
   __lowerCAmelCase  :      str    =						orig_model.diffusion_ema.eval()
   __lowerCAmelCase  :      Tuple    =						orig_model.state_dict()
   __lowerCAmelCase  :      str    =						rename_orig_weights(__A					)

   __lowerCAmelCase  :      Optional[int]    =						set(renamed_state_dict.keys()					) - set(diffusers_state_dict.keys()					)
   __lowerCAmelCase  :      Optional[int]    =						set(diffusers_state_dict.keys()					) - set(renamed_state_dict.keys()					)

   assert len(__A					) == 0, f'''Problem with {renamed_minus_diffusers}'''
   assert all(k.endswith("""kernel"""					) for k in list(__A					)					), f'''Problem with {diffusers_minus_renamed}'''

   for key, value in renamed_state_dict.items():
      assert (
          diffusers_state_dict[key].squeeze().shape == value.squeeze().shape
      ), f'''Shape for {key} doesn\'t match. Diffusers: {diffusers_state_dict[key].shape} vs. {value.shape}'''
      if key == "time_proj.weight":
         __lowerCAmelCase  :      Union[str, Any]    =						value.squeeze()

      __lowerCAmelCase  :      Optional[int]    =						value

   diffusers_model.load_state_dict(__A					)

   __lowerCAmelCase  :      Optional[Any]    =						1_0_0
   __lowerCAmelCase  :      Optional[int]    =						3_3

   __lowerCAmelCase  :      Dict    =						IPNDMScheduler(num_train_timesteps=__A					)

   __lowerCAmelCase  :      Union[str, Any]    =						torch.manual_seed(__A					)
   __lowerCAmelCase  :      Dict    =						torch.randn([1, 2, config.sample_size] ,       generator=__A					).to(__A					)

   __lowerCAmelCase  :      List[Any]    =						torch.linspace(1 ,       0 ,       steps + 1 ,       device=__A					)[:-1]
   __lowerCAmelCase  :      Union[str, Any]    =						get_crash_schedule(__A					)

   __lowerCAmelCase  :      Optional[Any]    =						DanceDiffusionPipeline(unet=__A ,       scheduler=__A					)

   __lowerCAmelCase  :      Tuple    =						torch.manual_seed(3_3					)
   __lowerCAmelCase  :      str    =						pipe(num_inference_steps=__A ,       generator=__A					).audios

   __lowerCAmelCase  :      Optional[Any]    =						sampling.iplms_sample(__A ,       __A ,       __A ,       {}					)
   __lowerCAmelCase  :      Union[str, Any]    =						generated.clamp(-1 ,       1					)

   __lowerCAmelCase  :      Any    =						(generated - audio).abs().sum()
   __lowerCAmelCase  :      str    =						(generated - audio).abs().max()

   if args.save:
      pipe.save_pretrained(args.checkpoint_path					)

   print("""Diff sum""" ,       __A					)
   print("""Diff max""" ,       __A					)

   assert diff_max < 1e-3, f'''Diff max: {diff_max} is too much :-/'''

   print(f'''Conversion for {model_name} successful!'''					)


if __name__ == "__main__":
   __UpperCAmelCase								=			argparse.ArgumentParser()

   parser.add_argument("""--model_path""", default=None, type=str, required=True, help="""Path to the model to convert.""")
   parser.add_argument(
       """--save""", default=True, type=bool, required=False, help="""Whether to save the converted model or not."""
   )
   parser.add_argument("""--checkpoint_path""", default=None, type=str, required=True, help="""Path to the output model.""")
   __UpperCAmelCase								=			parser.parse_args()

   main(args)





import json
import os
import unittest

from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow

from ...test_tokenization_common import TokenizerTesterMixin



class SCREAMING_SNAKE_CASE     (  a_       ,							unittest.TestCase			):
  """simple docstring"""






  lowerCamelCase   :      str										=DebertaTokenizer
  lowerCamelCase   :      Dict										=True
  lowerCamelCase   :      List[str]										=DebertaTokenizerFast







  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]   )							->     Union[str, Any]:






     """simple docstring"""







     super().setUp()

     # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
     __lowerCAmelCase  :      Optional[int]    =						[
         """l""",
         """o""",
         """w""",
         """e""",
         """r""",
         """s""",
         """t""",
         """i""",
         """d""",
         """n""",
         """\u0120""",
         """\u0120l""",
         """\u0120n""",
         """\u0120lo""",
         """\u0120low""",
         """er""",
         """\u0120lowest""",
         """\u0120newer""",
         """\u0120wider""",
         """[UNK]""",
     ]
     __lowerCAmelCase  :      Optional[int]    =						dict(zip(lowerCAmelCase	,							range(len(lowerCAmelCase   )   )   )   )
     __lowerCAmelCase  :      List[str]    =						["""#version: 0.2""", """\u0120 l""", """\u0120l o""", """\u0120lo w""", """e r""", """"""]
     __lowerCAmelCase  :      Any    =						{"""unk_token""": """[UNK]"""}

     __lowerCAmelCase  :      Tuple    =						os.path.join(self.tmpdirname	,							VOCAB_FILES_NAMES["""vocab_file"""]   )
     __lowerCAmelCase  :      Optional[int]    =						os.path.join(self.tmpdirname	,							VOCAB_FILES_NAMES["""merges_file"""]   )
     with open(self.vocab_file	,							"""w"""	,							encoding="""utf-8"""   ) as fp:
        fp.write(json.dumps(lowerCAmelCase   ) + """\n"""   )
     with open(self.merges_file	,							"""w"""	,							encoding="""utf-8"""   ) as fp:
        fp.write("""\n""".join(lowerCAmelCase   )   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   Optional[int]	,							**lowerCAmelCase			:   Tuple   )							->     Dict:






     """simple docstring"""







     kwargs.update(self.special_tokens_map   )
     return self.tokenizer_class.from_pretrained(self.tmpdirname	,							**lowerCAmelCase   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]	,							lowerCAmelCase			:   int   )							->     Optional[Any]:






     """simple docstring"""







     __lowerCAmelCase  :      Dict    =						"""lower newer"""
     __lowerCAmelCase  :      Union[str, Any]    =						"""lower newer"""
     return input_text, output_text







  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]   )							->     Optional[Any]:






     """simple docstring"""







     __lowerCAmelCase  :      List[Any]    =						self.get_tokenizer()
     __lowerCAmelCase  :      int    =						"""lower newer"""
     __lowerCAmelCase  :      Any    =						["""l""", """o""", """w""", """er""", """\u0120""", """n""", """e""", """w""", """er"""]
     __lowerCAmelCase  :      Union[str, Any]    =						tokenizer.tokenize(lowerCAmelCase   )
     self.assertListEqual(lowerCAmelCase	,							lowerCAmelCase   )

     __lowerCAmelCase  :      List[Any]    =						tokens + [tokenizer.unk_token]
     __lowerCAmelCase  :      Union[str, Any]    =						[0, 1, 2, 15, 10, 9, 3, 2, 15, 19]
     self.assertListEqual(tokenizer.convert_tokens_to_ids(lowerCAmelCase   )	,							lowerCAmelCase   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   Optional[Any]   )							->     Union[str, Any]:






     """simple docstring"""







     __lowerCAmelCase  :      int    =						self.get_tokenizer()
     __lowerCAmelCase  :      Any    =						tokenizer("""Hello"""	,							"""World"""   )
     __lowerCAmelCase  :      Tuple    =						[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
     self.assertListEqual(tokd["""token_type_ids"""]	,							lowerCAmelCase   )







  @slow
  def 	SCREAMING_SNAKE_CASE   (      self			:   Dict   )							->     str:






     """simple docstring"""







     __lowerCAmelCase  :      Optional[int]    =						self.tokenizer_class.from_pretrained("""microsoft/deberta-base"""   )

     __lowerCAmelCase  :      Optional[Any]    =						tokenizer.encode("""sequence builders"""	,							add_special_tokens=lowerCAmelCase   )
     __lowerCAmelCase  :      List[Any]    =						tokenizer.encode("""multi-sequence build"""	,							add_special_tokens=lowerCAmelCase   )

     __lowerCAmelCase  :      Dict    =						tokenizer.encode(
         """sequence builders"""	,							add_special_tokens=lowerCAmelCase	,							add_prefix_space=lowerCAmelCase   )
     __lowerCAmelCase  :      Dict    =						tokenizer.encode(
         """sequence builders"""	,							"""multi-sequence build"""	,							add_special_tokens=lowerCAmelCase	,							add_prefix_space=lowerCAmelCase   )

     __lowerCAmelCase  :      List[str]    =						tokenizer.build_inputs_with_special_tokens(lowerCAmelCase   )
     __lowerCAmelCase  :      Union[str, Any]    =						tokenizer.build_inputs_with_special_tokens(lowerCAmelCase	,							lowerCAmelCase   )

     assert encoded_sentence == encoded_text_from_decode
     assert encoded_pair == encoded_pair_from_decode







  @slow
  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]   )							->     Optional[Any]:






     """simple docstring"""







     __lowerCAmelCase  :      List[str]    =						[self.tokenizer_class]
     if self.test_rust_tokenizer:
        tokenizer_classes.append(self.rust_tokenizer_class   )

     for tokenizer_class in tokenizer_classes:
        __lowerCAmelCase  :      int    =						tokenizer_class.from_pretrained("""microsoft/deberta-base"""   )

        __lowerCAmelCase  :      Optional[Any]    =						[
            """ALBERT: A Lite BERT for Self-supervised Learning of Language Representations""",
            """ALBERT incorporates two parameter reduction techniques""",
            """The first one is a factorized embedding parameterization. By decomposing the large vocabulary"""
            """ embedding matrix into two small matrices, we separate the size of the hidden layers from the size of"""
            """ vocabulary embedding.""",
        ]

        __lowerCAmelCase  :      List[str]    =						tokenizer(lowerCAmelCase	,							padding=lowerCAmelCase   )
        __lowerCAmelCase  :      List[str]    =						[tokenizer.decode(lowerCAmelCase	,							skip_special_tokens=lowerCAmelCase   ) for seq in encoding["""input_ids"""]]

        # fmt: off
        __lowerCAmelCase  :      Any    =						{
            """input_ids""": [
                [1, 21_18, 1_11_26, 5_65, 35, 83, 2_51_91, 1_63, 1_88_54, 13, 1_21_56, 12, 1_61_01, 2_53_76, 1_38_07, 9, 2_22_05, 2_78_93, 16_35, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 21_18, 1_11_26, 5_65, 2_45_36, 80, 4_37_97, 48_78, 73_73, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1_33, 78, 65, 16, 10, 37_24, 15_38, 3_31_83, 1_13_03, 4_37_97, 19_38, 4, 8_70, 2_41_65, 2_91_05, 5, 7_39, 3_26_44, 3_31_83, 1_13_03, 3_61_73, 88, 80, 6_50, 78_21, 4_59_40, 6, 52, 25_59, 5, 18_36, 9, 5, 73_97, 1_31_71, 31, 5, 18_36, 9, 3_26_44, 3_31_83, 1_13_03, 4, 2]
            ],
            """token_type_ids""": [
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            ],
            """attention_mask""": [
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
            ]
        }
        # fmt: on

        __lowerCAmelCase  :      int    =						[
            """ALBERT: A Lite BERT for Self-supervised Learning of Language Representations""",
            """ALBERT incorporates two parameter reduction techniques""",
            """The first one is a factorized embedding parameterization. By decomposing the large vocabulary"""
            """ embedding matrix into two small matrices, we separate the size of the hidden layers from the size of"""
            """ vocabulary embedding.""",
        ]

        self.assertDictEqual(encoding.data	,							lowerCAmelCase   )

        for expected, decoded in zip(lowerCAmelCase	,							lowerCAmelCase   ):
           self.assertEqual(lowerCAmelCase	,							lowerCAmelCase   )


