


import copy

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


snake_case__     							= logging.get_logger(__name__)



class     snake_case__  (      _A  ):
				__lowerCAmelCase		=      '''hybrid-clip'''
				__lowerCAmelCase		=      True
				def __init__(  self     ,      _UpperCAmelCase=512     ,      **_UpperCAmelCase      ):




										"""simple docstring"""




										super().__init__(**_UpperCAmelCase      )

										if "text_config" not in kwargs:
																raise ValueError('`text_config` can not be `None`.'      )

										if "vision_config" not in kwargs:
																raise ValueError('`vision_config` can not be `None`.'      )

										__magic_name__				:							str				=      kwargs.pop('text_config'      )
										__magic_name__				:							Union[str, Any]				=      kwargs.pop('vision_config'      )

										__magic_name__				:							Union[str, Any]				=      text_config.pop('model_type'      )
										__magic_name__				:							Dict				=      vision_config.pop('model_type'      )

										from transformers import AutoConfig

										__magic_name__				:							str				=      AutoConfig.for_model(_UpperCAmelCase     ,      **_UpperCAmelCase      )

										if vision_model_type == "clip":
																__magic_name__				:							Optional[Any]				=      AutoConfig.for_model(_UpperCAmelCase     ,      **_UpperCAmelCase      ).vision_config
										elif vision_model_type == "clip_vision_model":
																from transformers import CLIPVisionConfig

																__magic_name__				:							int				=      CLIPVisionConfig(**_UpperCAmelCase      )
										else:
																__magic_name__				:							Optional[Any]				=      AutoConfig.for_model(_UpperCAmelCase     ,      **_UpperCAmelCase      )

										__magic_name__				:							Any				=      projection_dim
										__magic_name__				:							Union[str, Any]				=      1.0
				@classmethod
				def  UpperCamelCase_						(  cls     ,      _UpperCAmelCase     ,      _UpperCAmelCase     ,      **_UpperCAmelCase      ):




										"""simple docstring"""




										return cls(text_config=text_config.to_dict()     ,      vision_config=vision_config.to_dict()     ,      **_UpperCAmelCase      )





				def  UpperCamelCase_						(  self      ):




										"""simple docstring"""




										__magic_name__				:							str				=      copy.deepcopy(self.__dict__      )
										__magic_name__				:							Dict				=      self.text_config.to_dict()
										__magic_name__				:							str				=      self.vision_config.to_dict()
										__magic_name__				:							Any				=      self.__class__.model_type
										return output






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

# Load iris file
snake_case__     							= 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
snake_case__							,     snake_case__							,     snake_case__							,     snake_case__     							= train_test_split(
    iris['data'], iris['target'], random_state=4
)

# KNN

snake_case__     							= KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
snake_case__     							= [[1, 2, 1, 4], [2, 3, 4, 5]]

snake_case__     							= knn.predict(X_new)

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


