



"""simple docstring"""

import argparse
import collections
import json
from pathlib import Path

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

from transformers import (
    MobileViTImageProcessor,
    MobileViTVaConfig,
    MobileViTVaForImageClassification,
    MobileViTVaForSemanticSegmentation,
)
from transformers.utils import logging


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




def __lowercase    (							_a					):
    print('''Loading config file...'''					)

    def flatten_yaml_as_dict(_a	,    _a=""	,    _a="."					):
        snake_case_				:  List[Any]       =			[]
        for k, v in d.items():
            snake_case_				:  Tuple       =			parent_key + sep + k if parent_key else k
            if isinstance(_a	,    collections.abc.MutableMapping					):
                items.extend(flatten_yaml_as_dict(_a	,    _a	,    sep=_a					).items()					)
            else:
                items.append((new_key, v)					)
        return dict(_a					)

    snake_case_				:  Optional[Any]       =			argparse.Namespace()
    with open(_a	,    '''r'''					) as yaml_file:
        try:
            snake_case_				:  Optional[Any]       =			yaml.load(_a	,    Loader=yaml.FullLoader					)

            snake_case_				:  List[Any]       =			flatten_yaml_as_dict(_a					)
            for k, v in flat_cfg.items():
                setattr(_a	,    _a	,    _a					)
        except yaml.YAMLError as exc:
            logger.error('''Error while loading config file: {}. Error message: {}'''.format(_a	,    str(_a					)					)					)
    return config




def __lowercase    (							_a	,    _a					):
    snake_case_				:  List[Any]       =			MobileViTVaConfig()

    snake_case_				:  Optional[Any]       =			False

    # dataset
    if task_name.startswith('''imagenet1k_'''					):
        snake_case_				:  Optional[Any]       =			1_000
        if int(task_name.strip().split('''_'''					)[-1]					) == 384:
            snake_case_				:  Tuple       =			384
        else:
            snake_case_				:  List[Any]       =			256
        snake_case_				:  Optional[Any]       =			'''imagenet-1k-id2label.json'''
    elif task_name.startswith('''imagenet21k_to_1k_'''					):
        snake_case_				:  Optional[int]       =			21_000
        if int(task_name.strip().split('''_'''					)[-1]					) == 384:
            snake_case_				:  Tuple       =			384
        else:
            snake_case_				:  Optional[Any]       =			256
        snake_case_				:  Any       =			'''imagenet-22k-id2label.json'''
    elif task_name.startswith('''ade20k_'''					):
        snake_case_				:  Optional[int]       =			151
        snake_case_				:  Optional[Any]       =			512
        snake_case_				:  Tuple       =			'''ade20k-id2label.json'''
        snake_case_				:  List[str]       =			True
    elif task_name.startswith('''voc_'''					):
        snake_case_				:  Dict       =			21
        snake_case_				:  Optional[int]       =			512
        snake_case_				:  List[str]       =			'''pascal-voc-id2label.json'''
        snake_case_				:  str       =			True

    # orig_config
    snake_case_				:  Optional[int]       =			load_orig_config_file(_a					)
    assert getattr(_a	,    '''model.classification.name'''	,    -1					) == "mobilevit_v2", "Invalid model"
    snake_case_				:  List[Any]       =			getattr(_a	,    '''model.classification.mitv2.width_multiplier'''	,    1.0					)
    assert (
        getattr(_a	,    '''model.classification.mitv2.attn_norm_layer'''	,    -1					) == "layer_norm_2d"
    ), "Norm layers other than layer_norm_2d is not supported"
    snake_case_				:  str       =			getattr(_a	,    '''model.classification.activation.name'''	,    '''swish'''					)
    # config.image_size == getattr(orig_config,  'sampler.bs.crop_size_width', 256)

    if is_segmentation_model:
        snake_case_				:  Any       =			getattr(_a	,    '''model.segmentation.output_stride'''	,    16					)
        if "_deeplabv3" in task_name:
            snake_case_				:  Tuple       =			getattr(_a	,    '''model.segmentation.deeplabv3.aspp_rates'''	,    [12, 24, 36]					)
            snake_case_				:  List[str]       =			getattr(_a	,    '''model.segmentation.deeplabv3.aspp_out_channels'''	,    512					)
            snake_case_				:  Any       =			getattr(_a	,    '''model.segmentation.deeplabv3.aspp_dropout'''	,    0.1					)

    # id2label
    snake_case_				:  Union[str, Any]       =			'''huggingface/label-files'''
    snake_case_				:  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_				:  str       =			idalabel
    snake_case_				:  Tuple       =			{v: k for k, v in idalabel.items()}

    return config




def __lowercase    (							_a	,    _a	,    _a					):
    snake_case_				:  int       =			dct.pop(_a					)
    snake_case_				:  List[Any]       =			val




def __lowercase    (							_a	,    _a=False					):
    if base_model:
        snake_case_				:  Tuple       =			''''''
    else:
        snake_case_				:  Dict       =			'''mobilevitv2.'''

    snake_case_				:  int       =			[]
    for k in state_dict.keys():
        if k[:8] == "encoder.":
            snake_case_				:  str       =			k[8:]
        else:
            snake_case_				:  int       =			k

        if ".block." in k:
            snake_case_				:  Tuple       =			k_new.replace('''.block.'''	,    '''.'''					)
        if ".conv." in k:
            snake_case_				:  str       =			k_new.replace('''.conv.'''	,    '''.convolution.'''					)
        if ".norm." in k:
            snake_case_				:  int       =			k_new.replace('''.norm.'''	,    '''.normalization.'''					)

        if "conv_1." in k:
            snake_case_				:  Any       =			k_new.replace('''conv_1.'''	,    f"{model_prefix}conv_stem."					)
        for i in [1, 2]:
            if f"layer_{i}." in k:
                snake_case_				:  str       =			k_new.replace(f"layer_{i}."	,    f"{model_prefix}encoder.layer.{i-1}.layer."					)
        if ".exp_1x1." in k:
            snake_case_				:  int       =			k_new.replace('''.exp_1x1.'''	,    '''.expand_1x1.'''					)
        if ".red_1x1." in k:
            snake_case_				:  Union[str, Any]       =			k_new.replace('''.red_1x1.'''	,    '''.reduce_1x1.'''					)

        for i in [3, 4, 5]:
            if f"layer_{i}.0." in k:
                snake_case_				:  List[str]       =			k_new.replace(f"layer_{i}.0."	,    f"{model_prefix}encoder.layer.{i-1}.downsampling_layer."					)
            if f"layer_{i}.1.local_rep.0." in k:
                snake_case_				:  Any       =			k_new.replace(f"layer_{i}.1.local_rep.0."	,    f"{model_prefix}encoder.layer.{i-1}.conv_kxk."					)
            if f"layer_{i}.1.local_rep.1." in k:
                snake_case_				:  List[Any]       =			k_new.replace(f"layer_{i}.1.local_rep.1."	,    f"{model_prefix}encoder.layer.{i-1}.conv_1x1."					)

        for i in [3, 4, 5]:
            if i == 3:
                snake_case_				:  Tuple       =			[0, 1]
            elif i == 4:
                snake_case_				:  Dict       =			[0, 1, 2, 3]
            elif i == 5:
                snake_case_				:  str       =			[0, 1, 2]

            for j in j_in:
                if f"layer_{i}.1.global_rep.{j}." in k:
                    snake_case_				:  Dict       =			k_new.replace(
                        f"layer_{i}.1.global_rep.{j}."	,    f"{model_prefix}encoder.layer.{i-1}.transformer.layer.{j}."					)
            if f"layer_{i}.1.global_rep.{j+1}." in k:
                snake_case_				:  int       =			k_new.replace(
                    f"layer_{i}.1.global_rep.{j+1}."	,    f"{model_prefix}encoder.layer.{i-1}.layernorm."					)

            if f"layer_{i}.1.conv_proj." in k:
                snake_case_				:  Any       =			k_new.replace(f"layer_{i}.1.conv_proj."	,    f"{model_prefix}encoder.layer.{i-1}.conv_projection."					)

        if "pre_norm_attn.0." in k:
            snake_case_				:  int       =			k_new.replace('''pre_norm_attn.0.'''	,    '''layernorm_before.'''					)
        if "pre_norm_attn.1." in k:
            snake_case_				:  Any       =			k_new.replace('''pre_norm_attn.1.'''	,    '''attention.'''					)
        if "pre_norm_ffn.0." in k:
            snake_case_				:  List[Any]       =			k_new.replace('''pre_norm_ffn.0.'''	,    '''layernorm_after.'''					)
        if "pre_norm_ffn.1." in k:
            snake_case_				:  int       =			k_new.replace('''pre_norm_ffn.1.'''	,    '''ffn.conv1.'''					)
        if "pre_norm_ffn.3." in k:
            snake_case_				:  List[Any]       =			k_new.replace('''pre_norm_ffn.3.'''	,    '''ffn.conv2.'''					)

        if "classifier.1." in k:
            snake_case_				:  str       =			k_new.replace('''classifier.1.'''	,    '''classifier.'''					)

        if "seg_head." in k:
            snake_case_				:  List[Any]       =			k_new.replace('''seg_head.'''	,    '''segmentation_head.'''					)
        if ".aspp_layer." in k:
            snake_case_				:  Union[str, Any]       =			k_new.replace('''.aspp_layer.'''	,    '''.'''					)
        if ".aspp_pool." in k:
            snake_case_				:  str       =			k_new.replace('''.aspp_pool.'''	,    '''.'''					)

        rename_keys.append((k, k_new)					)
    return rename_keys




def __lowercase    (							_a					):
    snake_case_				:  Tuple       =			[]
    for k in state_dict.keys():
        if k.startswith('''seg_head.aux_head.'''					):
            keys_to_ignore.append(_a					)
    for k in keys_to_ignore:
        state_dict.pop(_a	,    _a					)




def __lowercase    (							):
    snake_case_				:  Optional[Any]       =			'''http://images.cocodataset.org/val2017/000000039769.jpg'''
    # url = "https://cdn.britannica.com/86/141086-050-9D7C75EE/Gulfstream-G450-business-jet-passengers.jpg"
    snake_case_				:  Optional[Any]       =			Image.open(requests.get(_a	,    stream=_a					).raw					)
    return im




@torch.no_grad()
def __lowercase    (							_a	,    _a	,    _a	,    _a					):
    snake_case_				:  List[Any]       =			get_mobilevitva_config(_a	,    _a					)

    # load original state_dict
    snake_case_				:  Union[str, Any]       =			torch.load(_a	,    map_location='''cpu'''					)

    # load huggingface model
    if task_name.startswith('''ade20k_'''					) or task_name.startswith('''voc_'''					):
        snake_case_				:  Optional[Any]       =			MobileViTVaForSemanticSegmentation(_a					).eval()
        snake_case_				:  Optional[Any]       =			False
    else:
        snake_case_				:  int       =			MobileViTVaForImageClassification(_a					).eval()
        snake_case_				:  Tuple       =			False

    # remove and rename some keys of load the original model
    snake_case_				:  List[Any]       =			checkpoint
    remove_unused_keys(_a					)
    snake_case_				:  List[Any]       =			create_rename_keys(_a	,    base_model=_a					)
    for rename_key_src, rename_key_dest in rename_keys:
        rename_key(_a	,    _a	,    _a					)

    # load modified state_dict
    model.load_state_dict(_a					)

    # Check outputs on an image, prepared by MobileViTImageProcessor
    snake_case_				:  Dict       =			MobileViTImageProcessor(crop_size=config.image_size	,    size=config.image_size + 32					)
    snake_case_				:  Optional[int]       =			image_processor(images=prepare_img()	,    return_tensors='''pt'''					)
    snake_case_				:  List[Any]       =			model(**_a					)

    # verify classification model
    if task_name.startswith('''imagenet'''					):
        snake_case_				:  List[Any]       =			outputs.logits
        snake_case_				:  List[str]       =			logits.argmax(-1					).item()
        print('''Predicted class:'''	,    model.config.idalabel[predicted_class_idx]					)
        if task_name.startswith('''imagenet1k_256'''					) and config.width_multiplier == 1.0:
            # expected_logits for base variant
            snake_case_				:  Union[str, Any]       =			torch.tensor([-1.6336E00, -7.3204E-02, -5.1883E-01]					)
            assert torch.allclose(logits[0, :3]	,    _a	,    atol=1E-4					)

    Path(_a					).mkdir(exist_ok=_a					)
    print(f"Saving model {task_name} to {pytorch_dump_folder_path}"					)
    model.save_pretrained(_a					)
    print(f"Saving image processor to {pytorch_dump_folder_path}"					)
    image_processor.save_pretrained(_a					)


if __name__ == "__main__":
     lowercase__					:						List[str]												=			argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         '''--task''',
         default='''imagenet1k_256''',
         type=str,
         help=(
             '''Name of the task for which the MobileViTV2 model you\'d like to convert is trained on . '''
             '''
                Classification (ImageNet-1k)
                    - MobileViTV2 (256x256) : imagenet1k_256
                    - MobileViTV2 (Trained on 256x256 and Finetuned on 384x384) : imagenet1k_384
                    - MobileViTV2 (Trained on ImageNet-21k and Finetuned on ImageNet-1k 256x256) :
                      imagenet21k_to_1k_256
                    - MobileViTV2 (Trained on ImageNet-21k, Finetuned on ImageNet-1k 256x256, and Finetuned on
                      ImageNet-1k 384x384) : imagenet21k_to_1k_384
                Segmentation
                    - ADE20K Dataset : ade20k_deeplabv3
                    - Pascal VOC 2012 Dataset: voc_deeplabv3
            '''
         ),
         choices=[
             '''imagenet1k_256''',
             '''imagenet1k_384''',
             '''imagenet21k_to_1k_256''',
             '''imagenet21k_to_1k_384''',
             '''ade20k_deeplabv3''',
             '''voc_deeplabv3''',
         ],
     )

     parser.add_argument(
         '''--orig_checkpoint_path''', required=True, type=str, help='''Path to the original state dict (.pt file).'''
     )
     parser.add_argument('''--orig_config_path''', required=True, type=str, help='''Path to the original config file.''')
     parser.add_argument(
         '''--pytorch_dump_folder_path''', required=True, type=str, help='''Path to the output PyTorch model directory.'''
     )

     lowercase__					:						Dict												=			parser.parse_args()
     convert_mobilevitva_checkpoint(
         args.task, args.orig_checkpoint_path, args.orig_config_path, args.pytorch_dump_folder_path
     )










"""simple docstring"""

import argparse

from tax import checkpoints

from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM




def __lowercase    (							_a	,    _a	,    _a					):
    snake_case_				:  Tuple       =			AutoConfig.from_pretrained(_a					)
    snake_case_				:  Tuple       =			FlaxAutoModelForSeqaSeqLM.from_config(config=_a					)
    snake_case_				:  Union[str, Any]       =			checkpoints.load_tax_checkpoint(_a					)

    snake_case_				:  Optional[int]       =			'''wi_0''' in tax_model['''target''']['''encoder''']['''layers_0''']['''mlp''']

    if config.model_type == "t5":
        snake_case_				:  str       =			'''SelfAttention'''
    if config.model_type == "longt5" and config.encoder_attention_type == "local":
        snake_case_				:  List[str]       =			'''LocalSelfAttention'''
    elif config.model_type == "longt5" and config.encoder_attention_type == "transient-global":
        snake_case_				:  Dict       =			'''TransientGlobalSelfAttention'''
    else:
        raise ValueError(
            '''Given config is expected to have `model_type=\'t5\'`, or `model_type=\'longt5` with `encoder_attention_type`'''
            ''' attribute with a value from [\'local\', \'transient-global].'''					)

    # Encoder
    for layer_index in range(config.num_layers					):
        snake_case_				:  Any       =			f"layers_{str(_a					)}"

        # Self-Attention
        snake_case_				:  Dict       =			tax_model['''target''']['''encoder'''][layer_name]['''attention''']['''key''']['''kernel''']
        snake_case_				:  Tuple       =			tax_model['''target''']['''encoder'''][layer_name]['''attention''']['''out''']['''kernel''']
        snake_case_				:  Tuple       =			tax_model['''target''']['''encoder'''][layer_name]['''attention''']['''query''']['''kernel''']
        snake_case_				:  Optional[int]       =			tax_model['''target''']['''encoder'''][layer_name]['''attention''']['''value''']['''kernel''']

        # Global input layer norm
        if config.model_type == "longt5" and config.encoder_attention_type == "transient-global":
            snake_case_				:  Tuple       =			tax_model['''target''']['''encoder'''][layer_name]['''attention''']['''T5LayerNorm_0''']['''scale''']

        # Layer Normalization
        snake_case_				:  List[str]       =			tax_model['''target''']['''encoder'''][layer_name]['''pre_attention_layer_norm''']['''scale''']

        if split_mlp_wi:
            snake_case_				:  int       =			tax_model['''target''']['''encoder'''][layer_name]['''mlp''']['''wi_0''']['''kernel''']
            snake_case_				:  List[str]       =			tax_model['''target''']['''encoder'''][layer_name]['''mlp''']['''wi_1''']['''kernel''']
        else:
            snake_case_				:  int       =			tax_model['''target''']['''encoder'''][layer_name]['''mlp''']['''wi''']['''kernel''']

        snake_case_				:  str       =			tax_model['''target''']['''encoder'''][layer_name]['''mlp''']['''wo''']['''kernel''']

        # Layer Normalization
        snake_case_				:  Optional[Any]       =			tax_model['''target''']['''encoder'''][layer_name]['''pre_mlp_layer_norm''']['''scale''']

        # Assigning
        snake_case_				:  Optional[Any]       =			flax_model.params['''encoder''']['''block'''][str(_a					)]['''layer''']
        snake_case_				:  List[str]       =			tax_attention_key
        snake_case_				:  Optional[Any]       =			tax_attention_out
        snake_case_				:  Any       =			tax_attention_query
        snake_case_				:  str       =			tax_attention_value

        snake_case_				:  Dict       =			tax_attention_layer_norm

        # Global input layer norm
        if config.model_type == "longt5" and config.encoder_attention_type == "transient-global":
            snake_case_				:  Union[str, Any]       =			tax_global_layer_norm

        if split_mlp_wi:
            snake_case_				:  Any       =			tax_mlp_wi_a
            snake_case_				:  List[Any]       =			tax_mlp_wi_a
        else:
            snake_case_				:  Union[str, Any]       =			tax_mlp_wi

        snake_case_				:  List[Any]       =			tax_mlp_wo
        snake_case_				:  int       =			tax_mlp_layer_norm

        snake_case_				:  Any       =			flax_model_encoder_layer_block

    # Only for layer 0:
    snake_case_				:  Optional[int]       =			tax_model['''target''']['''encoder''']['''relpos_bias''']['''rel_embedding'''].T
    snake_case_				:  Any       =			tax_encoder_rel_embedding

    # Side/global relative position_bias + layer norm
    if config.model_type == "longt5" and config.encoder_attention_type == "transient-global":
        snake_case_				:  List[str]       =			tax_model['''target''']['''encoder''']['''side_relpos_bias''']['''rel_embedding'''].T
        snake_case_				:  Tuple       =			tax_encoder_global_rel_embedding

    # Assigning
    snake_case_				:  Dict       =			tax_model['''target''']['''encoder''']['''encoder_norm''']['''scale''']
    snake_case_				:  Any       =			tax_encoder_norm

    # Decoder
    for layer_index in range(config.num_layers					):
        snake_case_				:  Tuple       =			f"layers_{str(_a					)}"

        # Self-Attention
        snake_case_				:  List[str]       =			tax_model['''target''']['''decoder'''][layer_name]['''self_attention''']['''key''']['''kernel''']
        snake_case_				:  Optional[int]       =			tax_model['''target''']['''decoder'''][layer_name]['''self_attention''']['''out''']['''kernel''']
        snake_case_				:  List[Any]       =			tax_model['''target''']['''decoder'''][layer_name]['''self_attention''']['''query''']['''kernel''']
        snake_case_				:  Optional[int]       =			tax_model['''target''']['''decoder'''][layer_name]['''self_attention''']['''value''']['''kernel''']

        # Layer Normalization
        snake_case_				:  str       =			tax_model['''target''']['''decoder'''][layer_name]['''pre_self_attention_layer_norm'''][
            '''scale'''
        ]

        # Encoder-Decoder-Attention
        snake_case_				:  Any       =			tax_model['''target''']['''decoder'''][layer_name]['''encoder_decoder_attention''']
        snake_case_				:  Optional[Any]       =			tax_enc_dec_attention_module['''key''']['''kernel''']
        snake_case_				:  str       =			tax_enc_dec_attention_module['''out''']['''kernel''']
        snake_case_				:  Union[str, Any]       =			tax_enc_dec_attention_module['''query''']['''kernel''']
        snake_case_				:  List[str]       =			tax_enc_dec_attention_module['''value''']['''kernel''']

        # Layer Normalization
        snake_case_				:  Optional[int]       =			tax_model['''target''']['''decoder'''][layer_name]['''pre_cross_attention_layer_norm''']['''scale''']

        # MLP
        if split_mlp_wi:
            snake_case_				:  List[Any]       =			tax_model['''target''']['''decoder'''][layer_name]['''mlp''']['''wi_0''']['''kernel''']
            snake_case_				:  List[str]       =			tax_model['''target''']['''decoder'''][layer_name]['''mlp''']['''wi_1''']['''kernel''']
        else:
            snake_case_				:  Dict       =			tax_model['''target''']['''decoder'''][layer_name]['''mlp''']['''wi''']['''kernel''']

        snake_case_				:  List[Any]       =			tax_model['''target''']['''decoder'''][layer_name]['''mlp''']['''wo''']['''kernel''']

        # Layer Normalization
        snake_case_				:  List[Any]       =			tax_model['''target''']['''decoder'''][layer_name]['''pre_mlp_layer_norm''']['''scale''']

        # Assigning
        snake_case_				:  Dict       =			flax_model.params['''decoder''']['''block'''][str(_a					)]['''layer''']
        snake_case_				:  int       =			tax_attention_key
        snake_case_				:  List[Any]       =			tax_attention_out
        snake_case_				:  Any       =			tax_attention_query
        snake_case_				:  Dict       =			tax_attention_value

        snake_case_				:  str       =			tax_pre_attention_layer_norm

        snake_case_				:  Any       =			tax_enc_dec_attention_key
        snake_case_				:  str       =			tax_enc_dec_attention_out
        snake_case_				:  int       =			tax_enc_dec_attention_query
        snake_case_				:  Any       =			tax_enc_dec_attention_value

        snake_case_				:  Optional[Any]       =			tax_cross_layer_norm

        if split_mlp_wi:
            snake_case_				:  Tuple       =			tax_mlp_wi_a
            snake_case_				:  List[Any]       =			tax_mlp_wi_a
        else:
            snake_case_				:  List[Any]       =			tax_mlp_wi

        snake_case_				:  Dict       =			tax_mlp_wo

        snake_case_				:  List[Any]       =			txa_mlp_layer_norm

        snake_case_				:  Optional[int]       =			flax_model_decoder_layer_block

    # Decoder Normalization
    snake_case_				:  str       =			tax_model['''target''']['''decoder''']['''decoder_norm''']['''scale''']
    snake_case_				:  Tuple       =			txa_decoder_norm

    # Only for layer 0:
    snake_case_				:  str       =			tax_model['''target''']['''decoder''']['''relpos_bias''']['''rel_embedding'''].T
    snake_case_				:  Optional[Any]       =			tax_decoder_rel_embedding

    # Token Embeddings
    snake_case_				:  Union[str, Any]       =			tax_model['''target''']['''token_embedder''']['''embedding''']
    snake_case_				:  Optional[int]       =			txa_token_embeddings

    # LM Head (only in v1.1 and LongT5 checkpoints)
    if "logits_dense" in tax_model["target"]["decoder"]:
        snake_case_				:  Union[str, Any]       =			tax_model['''target''']['''decoder''']['''logits_dense''']['''kernel''']

    flax_model.save_pretrained(_a					)
    print('''T5X Model was sucessfully converted!'''					)


if __name__ == "__main__":
     lowercase__					:						Tuple												=			argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         '''--t5x_checkpoint_path''', default=None, type=str, required=True, help='''Path the T5X checkpoint.'''
     )
     parser.add_argument('''--config_name''', default=None, type=str, required=True, help='''Config name of LongT5/T5 model.''')
     parser.add_argument(
         '''--flax_dump_folder_path''', default=None, type=str, required=True, help='''Path to the output FLAX model.'''
     )
     lowercase__					:						Dict												=			parser.parse_args()
     convert_tax_checkpoint_to_flax(args.tax_checkpoint_path, args.config_name, args.flax_dump_folder_path)





