

'''simple docstring'''





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


A_	= logging.get_logger(__name__)

A_	= {}


class  UpperCAmelCase (							UpperCAmelCase__    ):

		'''simple docstring'''






		SCREAMING_SNAKE_CASE_           =					'llama'
		SCREAMING_SNAKE_CASE_           =					['past_key_values']
		def __init__(					self   ,			SCREAMING_SNAKE_CASE_=32000   ,			SCREAMING_SNAKE_CASE_=4096   ,			SCREAMING_SNAKE_CASE_=11008   ,			SCREAMING_SNAKE_CASE_=32   ,			SCREAMING_SNAKE_CASE_=32   ,			SCREAMING_SNAKE_CASE_=None   ,			SCREAMING_SNAKE_CASE_="silu"   ,			SCREAMING_SNAKE_CASE_=2048   ,			SCREAMING_SNAKE_CASE_=0.02   ,			SCREAMING_SNAKE_CASE_=1E-6   ,			SCREAMING_SNAKE_CASE_=True   ,			SCREAMING_SNAKE_CASE_=0   ,			SCREAMING_SNAKE_CASE_=1   ,			SCREAMING_SNAKE_CASE_=2   ,			SCREAMING_SNAKE_CASE_=1   ,			SCREAMING_SNAKE_CASE_=False   ,			SCREAMING_SNAKE_CASE_=None   ,			**SCREAMING_SNAKE_CASE_   ,			)  ->     List[Any]:






							'''simple docstring'''



							lowerCamelCase_  				=      vocab_size
							lowerCamelCase_  				=      max_position_embeddings
							lowerCamelCase_  				=      hidden_size
							lowerCamelCase_  				=      intermediate_size
							lowerCamelCase_  				=      num_hidden_layers
							lowerCamelCase_  				=      num_attention_heads

							# for backward compatibility
							if num_key_value_heads is None:
												lowerCamelCase_  				=      num_attention_heads

							lowerCamelCase_  				=      num_key_value_heads
							lowerCamelCase_  				=      hidden_act
							lowerCamelCase_  				=      initializer_range
							lowerCamelCase_  				=      rms_norm_eps
							lowerCamelCase_  				=      pretraining_tp
							lowerCamelCase_  				=      use_cache
							lowerCamelCase_  				=      rope_scaling
							self._rope_scaling_validation()

							super().__init__(
							    pad_token_id=SCREAMING_SNAKE_CASE_   ,			bos_token_id=SCREAMING_SNAKE_CASE_   ,			eos_token_id=SCREAMING_SNAKE_CASE_   ,			tie_word_embeddings=SCREAMING_SNAKE_CASE_   ,			**SCREAMING_SNAKE_CASE_   ,			)






		def 			UpperCamelCase(					self		)  ->     int:






							'''simple docstring'''



							if self.rope_scaling is None:
												return

							if not isinstance(self.rope_scaling   ,			SCREAMING_SNAKE_CASE_		) or len(self.rope_scaling		) != 2:
												raise ValueError(
												    '`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, '
												    f'''got {self.rope_scaling}'''		)
							lowerCamelCase_  				=      self.rope_scaling.get('type'   ,			SCREAMING_SNAKE_CASE_		)
							lowerCamelCase_  				=      self.rope_scaling.get('factor'   ,			SCREAMING_SNAKE_CASE_		)
							if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
												raise ValueError(
												    f'''`rope_scaling`\'s name field must be one of [\'linear\', \'dynamic\'], got {rope_scaling_type}'''		)
							if rope_scaling_factor is None or not isinstance(SCREAMING_SNAKE_CASE_   ,			SCREAMING_SNAKE_CASE_		) or rope_scaling_factor <= 1.0:
												raise ValueError(f'''`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'''		)




# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from argparse import ArgumentParser

from accelerate.commands.config import get_config_parser
from accelerate.commands.env import env_command_parser
from accelerate.commands.launch import launch_command_parser
from accelerate.commands.test import test_command_parser
from accelerate.commands.tpu import tpu_command_parser



def 	__A		(      ):



 """simple docstring"""


 __a							=	ArgumentParser("Accelerate CLI tool"				,					usage="accelerate <command> [<args>]"				,					allow_abbrev=_A       )
 __a							=	parser.add_subparsers(help="accelerate command helpers"       )

 # Register commands
 get_config_parser(subparsers=_A       )
 env_command_parser(subparsers=_A       )
 launch_command_parser(subparsers=_A       )
 tpu_command_parser(subparsers=_A       )
 test_command_parser(subparsers=_A       )

 # Let's go
 __a							=	parser.parse_args()

 if not hasattr(_A				,					"func"       ):
  parser.print_help()
  exit(1       )

 # Run
 args.func(_A       )


if __name__ == "__main__":
  main()


