






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


_UpperCAmelCase				:	List[str]    						=    logging.get_logger(__name__)

_UpperCAmelCase				:	List[Any]    						=    {
    'google/pegasus-x-base': 'https://huggingface.co/google/pegasus-x-base/resolve/main/config.json',
    'google/pegasus-x-large': 'https://huggingface.co/google/pegasus-x-large/resolve/main/config.json',
    # See all PEGASUS-X models at https://huggingface.co/models?filter=pegasus-x
}


class 		lowerCAmelCase_							(     UpperCamelCase   ):
     __lowerCamelCase					:						Optional[int]     =    '''pegasus_x'''
     __lowerCamelCase					:						Tuple     =    ['''past_key_values''']
     __lowerCamelCase					:						Any     =    {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}





     def __init__(  self       ,   _UpperCAmelCase=96103       ,   _UpperCAmelCase=16384       ,   _UpperCAmelCase=16       ,   _UpperCAmelCase=4096       ,   _UpperCAmelCase=16       ,   _UpperCAmelCase=16       ,   _UpperCAmelCase=4096       ,   _UpperCAmelCase=16       ,   _UpperCAmelCase=0.0       ,   _UpperCAmelCase=0.0       ,   _UpperCAmelCase=True       ,   _UpperCAmelCase=True       ,   _UpperCAmelCase="gelu"       ,   _UpperCAmelCase=1024       ,   _UpperCAmelCase=0.1       ,   _UpperCAmelCase=0.0       ,   _UpperCAmelCase=0.0       ,   _UpperCAmelCase=0.02       ,   _UpperCAmelCase=0       ,   _UpperCAmelCase=True       ,   _UpperCAmelCase=0       ,   _UpperCAmelCase=1       ,   _UpperCAmelCase=1       ,   _UpperCAmelCase=32       ,   _UpperCAmelCase=512       ,   _UpperCAmelCase=True       ,   **_UpperCAmelCase       ,   )		->							List[Any]:
        lowerCamelCase											=vocab_size
        lowerCamelCase											=max_position_embeddings
        lowerCamelCase											=d_model
        lowerCamelCase											=encoder_ffn_dim
        lowerCamelCase											=encoder_layers
        lowerCamelCase											=encoder_attention_heads
        lowerCamelCase											=decoder_ffn_dim
        lowerCamelCase											=decoder_layers
        lowerCamelCase											=decoder_attention_heads
        lowerCamelCase											=dropout
        lowerCamelCase											=attention_dropout
        lowerCamelCase											=activation_dropout
        lowerCamelCase											=activation_function
        lowerCamelCase											=init_std
        lowerCamelCase											=encoder_layerdrop
        lowerCamelCase											=decoder_layerdrop
        lowerCamelCase											=use_cache
        lowerCamelCase											=encoder_layers
        lowerCamelCase											=scale_embedding  # scale factor will be sqrt(d_model) if True

        lowerCamelCase											=num_global_tokens
        lowerCamelCase											=block_size
        lowerCamelCase											=stagger_local_blocks

        super().__init__(
            pad_token_id=_UpperCAmelCase       ,   eos_token_id=_UpperCAmelCase       ,   is_encoder_decoder=_UpperCAmelCase       ,   decoder_start_token_id=_UpperCAmelCase       ,   forced_eos_token_id=_UpperCAmelCase       ,   **_UpperCAmelCase       ,   )





     @property
     def 	lowerCamelCase       (  self     )		->							int:
        return self.encoder_attention_heads





     @property
     def 	lowerCamelCase       (  self     )		->							int:
        return self.d_model







from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier

# Load iris file
_UpperCAmelCase				:	Optional[int]    						=    load_iris()
iris.keys()


print(f"Target names: \n {iris.target_names} ")
print(f"\n Features: \n {iris.feature_names}")

# Train set e Test set
_UpperCAmelCase						,						_UpperCAmelCase						,						_UpperCAmelCase						,						_UpperCAmelCase				:	List[Any]    						=    train_test_split(
    iris['data'], iris['target'], random_state=4
)

# KNN

_UpperCAmelCase				:	Optional[int]    						=    KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
_UpperCAmelCase				:	List[Any]    						=    [[1, 2, 1, 4], [2, 3, 4, 5]]

_UpperCAmelCase				:	Tuple    						=    knn.predict(X_new)

print(
    f"\nNew array: \n {X_new}\n\nTarget Names Prediction: \n"
    f" {iris['target_names'][prediction]}"
)