





'''simple docstring'''

from ...configuration_utils import PretrainedConfig
from ...utils import logging


__lowerCamelCase : Tuple											=			logging.get_logger(__name__)

__lowerCamelCase : Tuple											=			{"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"}

class       UpperCAmelCase (						_lowercase  ):
  UpperCAmelCase					:	Optional[int] 			=		'''openai-gpt'''
  UpperCAmelCase					:	List[Any] 			=		{
      '''max_position_embeddings''': '''n_positions''',
      '''hidden_size''': '''n_embd''',
      '''num_attention_heads''': '''n_head''',
      '''num_hidden_layers''': '''n_layer''',
  }




  def __init__(self      :	Dict							,			A__      :	Tuple=4_0_4_7_8							,			A__      :	Any=5_1_2							,			A__      :	Optional[int]=7_6_8							,			A__      :	Optional[int]=1_2							,			A__      :	str=1_2							,			A__      :	Optional[Any]="gelu"							,			A__      :	Any=0.1							,			A__      :	Dict=0.1							,			A__      :	int=0.1							,			A__      :	Tuple=1e-5							,			A__      :	Optional[int]=0.0_2							,			A__      :	Tuple="cls_index"							,			A__      :	Any=True							,			A__      :	Optional[int]=None							,			A__      :	str=True							,			A__      :	Dict=0.1							,			**A__      :	Dict							,			)					-> int:
      lowercase         = vocab_size
      lowercase         = n_positions
      lowercase         = n_embd
      lowercase         = n_layer
      lowercase         = n_head
      lowercase         = afn
      lowercase         = resid_pdrop
      lowercase         = embd_pdrop
      lowercase         = attn_pdrop
      lowercase         = layer_norm_epsilon
      lowercase         = initializer_range
      lowercase         = summary_type
      lowercase         = summary_use_proj
      lowercase         = summary_activation
      lowercase         = summary_first_dropout
      lowercase         = summary_proj_to_labels
      super().__init__(**A__				)











'''simple docstring'''

from argparse import ArgumentParser

from . import BaseTransformersCLICommand







def 							UpperCAmelCase_    (	lowerCAmelCase_							):

				"""simple docstring"""






				return DownloadCommand(args.model		,							args.cache_dir		,							args.force		,							args.trust_remote_code							)


class       UpperCAmelCase (						_lowercase  ):




		@staticmethod
		def 				UpperCAmelCase__   (A__      :	ArgumentParser				)					-> List[Any]:
						lowercase         = parser.add_parser("download"				)
						download_parser.add_argument(
						    "--cache-dir"							,			type=A__							,			default=A__							,			help="Path to location to store the models"				)
						download_parser.add_argument(
						    "--force"							,			action="store_true"							,			help="Force the model to be download even if already in cache-dir"				)
						download_parser.add_argument(
						    "--trust-remote-code"							,			action="store_true"							,			help="Whether or not to allow for custom models defined on the Hub in their own modeling files. Use only if you've reviewed the code as it will execute on your local machine"							,			)
						download_parser.add_argument("model"							,			type=A__							,			help="Name of the model to download"				)
						download_parser.set_defaults(func=A__				)




		def __init__(self      :	Tuple							,			A__      :	str							,			A__      :	str							,			A__      :	bool							,			A__      :	bool				)					-> str:
						lowercase         = model
						lowercase         = cache
						lowercase         = force
						lowercase         = trust_remote_code





		def 				UpperCAmelCase__   (self      :	Union[str, Any]				)					-> Dict:
						from ..models.auto import AutoModel, AutoTokenizer

						AutoModel.from_pretrained(
						    self._model							,			cache_dir=self._cache							,			force_download=self._force							,			trust_remote_code=self._trust_remote_code				)
						AutoTokenizer.from_pretrained(
						    self._model							,			cache_dir=self._cache							,			force_download=self._force							,			trust_remote_code=self._trust_remote_code				)




