"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_A   					=    {
    'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'],
    'tokenization_lxmert': ['LxmertTokenizer'],
}

try:
				if not is_tokenizers_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_A   					=    ['LxmertTokenizerFast']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_A   					=    [
				    'LxmertEncoder',
				    'LxmertForPreTraining',
				    'LxmertForQuestionAnswering',
				    'LxmertModel',
				    'LxmertPreTrainedModel',
				    'LxmertVisualFeatureEncoder',
				    'LxmertXLayer',
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_A   					=    [
				    'TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'TFLxmertForPreTraining',
				    'TFLxmertMainLayer',
				    'TFLxmertModel',
				    'TFLxmertPreTrainedModel',
				    'TFLxmertVisualFeatureEncoder',
				]


if TYPE_CHECKING:
				from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
				from .tokenization_lxmert import LxmertTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_lxmert_fast import LxmertTokenizerFast

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_lxmert import (
								    LxmertEncoder,
								    LxmertForPreTraining,
								    LxmertForQuestionAnswering,
								    LxmertModel,
								    LxmertPreTrainedModel,
								    LxmertVisualFeatureEncoder,
								    LxmertXLayer,
								)

				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_lxmert import (
								    TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFLxmertForPreTraining,
								    TFLxmertMainLayer,
								    TFLxmertModel,
								    TFLxmertPreTrainedModel,
								    TFLxmertVisualFeatureEncoder,
								)

else:
				import sys

				_A   					=    _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)





"""simple docstring"""






import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


_A   					=    ['small', 'medium', 'large']

_A   					=    'lm_head.decoder.weight'
_A   					=    'lm_head.weight'




def 						SCREAMING_SNAKE_CASE					(  __UpperCAmelCase  ,					__UpperCAmelCase       )							->   List[str]:
				SCREAMING_SNAKE_CASE__		  =				torch.load(__UpperCAmelCase       )
				SCREAMING_SNAKE_CASE__		  =				d.pop(__UpperCAmelCase       )
				os.makedirs(__UpperCAmelCase  ,					exist_ok=__UpperCAmelCase       )
				torch.save(__UpperCAmelCase  ,					os.path.join(__UpperCAmelCase  ,					__UpperCAmelCase       )       )


if __name__ == "__main__":
						_A   					=    argparse.ArgumentParser()
						parser.add_argument('--dialogpt_path', default='.', type=str)
						_A   					=    parser.parse_args()
						for MODEL in DIALOGPT_MODELS:
												_A   					=    os.path.join(args.dialogpt_path, F'{MODEL}_ft.pkl')
												_A   					=    F'./DialoGPT-{MODEL}'
												convert_dialogpt_checkpoint(
												    checkpoint_path,
												    pytorch_dump_folder_path,
												)




