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


UpperCAmelCase      		=					logging.get_logger(__name__)

UpperCAmelCase      		=					{
    '''openbmb/cpm-ant-10b''': '''https://huggingface.co/openbmb/cpm-ant-10b/blob/main/config.json'''
    # See all CPMAnt models at https://huggingface.co/models?filter=cpmant
}




class  __lowerCAmelCase	(							a_    ):



 '''simple docstring'''
 _lowerCamelCase    :						Any					     =			'cpmant'

 def __init__(      self							:		List[Any]							,      lowerCamelCase							:		int = 3_0_7_2_0							,      lowerCamelCase							:		int = 4_0_9_6							,      lowerCamelCase							:		int = 3_2							,      lowerCamelCase							:		int = 1_2_8							,      lowerCamelCase							:		int = 1_0_2_4_0							,      lowerCamelCase							:		int = 4_8							,      lowerCamelCase							:		int = 0.0							,      lowerCamelCase							:		int = 5_1_2							,      lowerCamelCase							:		int = 2_0_4_8							,      lowerCamelCase							:		int = 1e-6							,      lowerCamelCase							:		float = 1.0							,      lowerCamelCase							:		int = 3_2							,      lowerCamelCase							:		int = 3_2							,      lowerCamelCase							:		int = 3_2							,      lowerCamelCase							:		bool = True							,      **lowerCamelCase							:		int							,      )			->				Dict:
        super().__init__(**lowerCamelCase	)
        _UpperCamelCase  :							Union[str, Any]	    =	prompt_types
        _UpperCamelCase  :							Optional[Any]	    =	prompt_length
        _UpperCamelCase  :							Optional[int]	    =	segment_types
        _UpperCamelCase  :							List[str]	    =	hidden_size
        _UpperCamelCase  :							List[str]	    =	num_attention_heads
        _UpperCamelCase  :							str	    =	dim_head
        _UpperCamelCase  :							Optional[int]	    =	dim_ff
        _UpperCamelCase  :							List[str]	    =	num_hidden_layers
        _UpperCamelCase  :							List[Any]	    =	position_bias_num_buckets
        _UpperCamelCase  :							Optional[Any]	    =	position_bias_max_distance
        _UpperCamelCase  :							Dict	    =	dropout_p
        _UpperCamelCase  :							int	    =	eps
        _UpperCamelCase  :							List[str]	    =	use_cache
        _UpperCamelCase  :							List[Any]	    =	vocab_size
        _UpperCamelCase  :							int	    =	init_std




from typing import TYPE_CHECKING

from ..utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available


UpperCAmelCase      		=					{
    '''configuration_utils''': ['''GenerationConfig'''],
    '''streamers''': ['''TextIteratorStreamer''', '''TextStreamer'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=					[
     '''Constraint''',
     '''ConstraintListState''',
     '''DisjunctiveConstraint''',
     '''PhrasalConstraint''',
 ]
 UpperCAmelCase      		=					[
     '''BeamHypotheses''',
     '''BeamScorer''',
     '''BeamSearchScorer''',
     '''ConstrainedBeamSearchScorer''',
 ]
 UpperCAmelCase      		=					[
     '''EpsilonLogitsWarper''',
     '''EtaLogitsWarper''',
     '''ForcedBOSTokenLogitsProcessor''',
     '''ForcedEOSTokenLogitsProcessor''',
     '''HammingDiversityLogitsProcessor''',
     '''InfNanRemoveLogitsProcessor''',
     '''LogitsProcessor''',
     '''LogitsProcessorList''',
     '''LogitsWarper''',
     '''MinLengthLogitsProcessor''',
     '''MinNewTokensLengthLogitsProcessor''',
     '''NoBadWordsLogitsProcessor''',
     '''NoRepeatNGramLogitsProcessor''',
     '''PrefixConstrainedLogitsProcessor''',
     '''RepetitionPenaltyLogitsProcessor''',
     '''SequenceBiasLogitsProcessor''',
     '''EncoderRepetitionPenaltyLogitsProcessor''',
     '''TemperatureLogitsWarper''',
     '''TopKLogitsWarper''',
     '''TopPLogitsWarper''',
     '''TypicalLogitsWarper''',
     '''EncoderNoRepeatNGramLogitsProcessor''',
     '''ExponentialDecayLengthPenalty''',
     '''LogitNormalization''',
 ]
 UpperCAmelCase      		=					[
     '''MaxNewTokensCriteria''',
     '''MaxLengthCriteria''',
     '''MaxTimeCriteria''',
     '''StoppingCriteria''',
     '''StoppingCriteriaList''',
     '''validate_stopping_criteria''',
 ]
 UpperCAmelCase      		=					[
     '''GenerationMixin''',
     '''top_k_top_p_filtering''',
     '''GreedySearchEncoderDecoderOutput''',
     '''GreedySearchDecoderOnlyOutput''',
     '''SampleEncoderDecoderOutput''',
     '''SampleDecoderOnlyOutput''',
     '''BeamSearchEncoderDecoderOutput''',
     '''BeamSearchDecoderOnlyOutput''',
     '''BeamSampleEncoderDecoderOutput''',
     '''BeamSampleDecoderOnlyOutput''',
     '''ContrastiveSearchEncoderDecoderOutput''',
     '''ContrastiveSearchDecoderOnlyOutput''',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=					[
     '''TFForcedBOSTokenLogitsProcessor''',
     '''TFForcedEOSTokenLogitsProcessor''',
     '''TFLogitsProcessor''',
     '''TFLogitsProcessorList''',
     '''TFLogitsWarper''',
     '''TFMinLengthLogitsProcessor''',
     '''TFNoBadWordsLogitsProcessor''',
     '''TFNoRepeatNGramLogitsProcessor''',
     '''TFRepetitionPenaltyLogitsProcessor''',
     '''TFTemperatureLogitsWarper''',
     '''TFTopKLogitsWarper''',
     '''TFTopPLogitsWarper''',
     '''TFForceTokensLogitsProcessor''',
     '''TFSuppressTokensAtBeginLogitsProcessor''',
     '''TFSuppressTokensLogitsProcessor''',
 ]
 UpperCAmelCase      		=					[
     '''TFGenerationMixin''',
     '''tf_top_k_top_p_filtering''',
     '''TFGreedySearchDecoderOnlyOutput''',
     '''TFGreedySearchEncoderDecoderOutput''',
     '''TFSampleEncoderDecoderOutput''',
     '''TFSampleDecoderOnlyOutput''',
     '''TFBeamSearchEncoderDecoderOutput''',
     '''TFBeamSearchDecoderOnlyOutput''',
     '''TFBeamSampleEncoderDecoderOutput''',
     '''TFBeamSampleDecoderOnlyOutput''',
     '''TFContrastiveSearchEncoderDecoderOutput''',
     '''TFContrastiveSearchDecoderOnlyOutput''',
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=					[
     '''FlaxForcedBOSTokenLogitsProcessor''',
     '''FlaxForcedEOSTokenLogitsProcessor''',
     '''FlaxLogitsProcessor''',
     '''FlaxLogitsProcessorList''',
     '''FlaxLogitsWarper''',
     '''FlaxMinLengthLogitsProcessor''',
     '''FlaxTemperatureLogitsWarper''',
     '''FlaxTopKLogitsWarper''',
     '''FlaxTopPLogitsWarper''',
 ]
 UpperCAmelCase      		=					[
     '''FlaxGenerationMixin''',
     '''FlaxGreedySearchOutput''',
     '''FlaxSampleOutput''',
     '''FlaxBeamSearchOutput''',
 ]

if TYPE_CHECKING:
 from .configuration_utils import GenerationConfig
 from .streamers import TextIteratorStreamer, TextStreamer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .beam_constraints import Constraint, ConstraintListState, DisjunctiveConstraint, PhrasalConstraint
  from .beam_search import BeamHypotheses, BeamScorer, BeamSearchScorer, ConstrainedBeamSearchScorer
  from .logits_process import (
      EncoderNoRepeatNGramLogitsProcessor,
      EncoderRepetitionPenaltyLogitsProcessor,
      EpsilonLogitsWarper,
      EtaLogitsWarper,
      ExponentialDecayLengthPenalty,
      ForcedBOSTokenLogitsProcessor,
      ForcedEOSTokenLogitsProcessor,
      HammingDiversityLogitsProcessor,
      InfNanRemoveLogitsProcessor,
      LogitNormalization,
      LogitsProcessor,
      LogitsProcessorList,
      LogitsWarper,
      MinLengthLogitsProcessor,
      MinNewTokensLengthLogitsProcessor,
      NoBadWordsLogitsProcessor,
      NoRepeatNGramLogitsProcessor,
      PrefixConstrainedLogitsProcessor,
      RepetitionPenaltyLogitsProcessor,
      SequenceBiasLogitsProcessor,
      TemperatureLogitsWarper,
      TopKLogitsWarper,
      TopPLogitsWarper,
      TypicalLogitsWarper,
  )
  from .stopping_criteria import (
      MaxLengthCriteria,
      MaxNewTokensCriteria,
      MaxTimeCriteria,
      StoppingCriteria,
      StoppingCriteriaList,
      validate_stopping_criteria,
  )
  from .utils import (
      BeamSampleDecoderOnlyOutput,
      BeamSampleEncoderDecoderOutput,
      BeamSearchDecoderOnlyOutput,
      BeamSearchEncoderDecoderOutput,
      ContrastiveSearchDecoderOnlyOutput,
      ContrastiveSearchEncoderDecoderOutput,
      GenerationMixin,
      GreedySearchDecoderOnlyOutput,
      GreedySearchEncoderDecoderOutput,
      SampleDecoderOnlyOutput,
      SampleEncoderDecoderOutput,
      top_k_top_p_filtering,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tf_logits_process import (
      TFForcedBOSTokenLogitsProcessor,
      TFForcedEOSTokenLogitsProcessor,
      TFForceTokensLogitsProcessor,
      TFLogitsProcessor,
      TFLogitsProcessorList,
      TFLogitsWarper,
      TFMinLengthLogitsProcessor,
      TFNoBadWordsLogitsProcessor,
      TFNoRepeatNGramLogitsProcessor,
      TFRepetitionPenaltyLogitsProcessor,
      TFSuppressTokensAtBeginLogitsProcessor,
      TFSuppressTokensLogitsProcessor,
      TFTemperatureLogitsWarper,
      TFTopKLogitsWarper,
      TFTopPLogitsWarper,
  )
  from .tf_utils import (
      TFBeamSampleDecoderOnlyOutput,
      TFBeamSampleEncoderDecoderOutput,
      TFBeamSearchDecoderOnlyOutput,
      TFBeamSearchEncoderDecoderOutput,
      TFContrastiveSearchDecoderOnlyOutput,
      TFContrastiveSearchEncoderDecoderOutput,
      TFGenerationMixin,
      TFGreedySearchDecoderOnlyOutput,
      TFGreedySearchEncoderDecoderOutput,
      TFSampleDecoderOnlyOutput,
      TFSampleEncoderDecoderOutput,
      tf_top_k_top_p_filtering,
  )

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .flax_logits_process import (
      FlaxForcedBOSTokenLogitsProcessor,
      FlaxForcedEOSTokenLogitsProcessor,
      FlaxLogitsProcessor,
      FlaxLogitsProcessorList,
      FlaxLogitsWarper,
      FlaxMinLengthLogitsProcessor,
      FlaxTemperatureLogitsWarper,
      FlaxTopKLogitsWarper,
      FlaxTopPLogitsWarper,
  )
  from .flax_utils import FlaxBeamSearchOutput, FlaxGenerationMixin, FlaxGreedySearchOutput, FlaxSampleOutput
else:
 import sys

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



