
def      __lowerCAmelCase						(							UpperCAmelCase__				:      Any			,				UpperCAmelCase__				:      List[Any]       )  ->    List[str]:
							lowerCamelCase_							  =					0
							lowerCamelCase_							  =					len(lowerCAmelCase_       ) - 1

							while left <= right:
														# avoid divided by 0 during interpolation
														if sorted_collection[left] == sorted_collection[right]:
																					if sorted_collection[left] == item:
																												return left
																					else:
																												return None

														lowerCamelCase_							  =					left + ((item - sorted_collection[left]) * (right - left)) // (
														    sorted_collection[right] - sorted_collection[left]
														)

														# out of range check
														if point < 0 or point >= len(lowerCAmelCase_       ):
																					return None

														lowerCamelCase_							  =					sorted_collection[point]
														if current_item == item:
																					return point
														else:
																					if point < left:
																												lowerCamelCase_							  =					left
																												lowerCamelCase_							  =					point
																					elif point > right:
																												lowerCamelCase_							  =					right
																												lowerCamelCase_							  =					point
																					else:
																												if item < current_item:
																																			lowerCamelCase_							  =					point - 1
																												else:
																																			lowerCamelCase_							  =					point + 1
							return None



def      __lowerCAmelCase						(							UpperCAmelCase__				:      str			,				UpperCAmelCase__				:      List[Any]			,				UpperCAmelCase__				:      int			,				UpperCAmelCase__				:      Optional[Any]       )  ->    Optional[Any]:


							if sorted_collection[left] == sorted_collection[right]:
														if sorted_collection[left] == item:
																					return left
														else:
																					return None

							lowerCamelCase_							  =					left + ((item - sorted_collection[left]) * (right - left)) // (
							    sorted_collection[right] - sorted_collection[left]
							)

							# out of range check
							if point < 0 or point >= len(lowerCAmelCase_       ):
														return None

							if sorted_collection[point] == item:
														return point
							elif point < left:
														return interpolation_search_by_recursion(lowerCAmelCase_			,				lowerCAmelCase_			,				lowerCAmelCase_			,				lowerCAmelCase_       )
							elif point > right:
														return interpolation_search_by_recursion(lowerCAmelCase_			,				lowerCAmelCase_			,				lowerCAmelCase_			,				lowerCAmelCase_       )
							else:
														if sorted_collection[point] > item:
																					return interpolation_search_by_recursion(
																					    lowerCAmelCase_			,				lowerCAmelCase_			,				lowerCAmelCase_			,				point - 1       )
														else:
																					return interpolation_search_by_recursion(
																					    lowerCAmelCase_			,				lowerCAmelCase_			,				point + 1			,				lowerCAmelCase_       )



def      __lowerCAmelCase						(							UpperCAmelCase__				:      Union[str, Any]       )  ->    List[Any]:


							if collection != sorted(lowerCAmelCase_       ):
														raise ValueError("""Collection must be ascending sorted"""       )
							return True


if __name__ == "__main__":
		import sys
		lowercase        =  0
		if debug == 1:
				lowercase        =  [1_0, 3_0, 4_0, 4_5, 5_0, 6_6, 7_7, 9_3]
				try:
						__assert_sorted(collection)
				except ValueError:
						sys.exit('''Sequence must be ascending sorted to apply interpolation search''')
				lowercase        =  6_7

		lowercase        =  interpolation_search(collection, target)
		if result is not None:
				print(F"""{target} found at positions: {result}""")
		else:
				print('''Not found''')







from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType





class       __A(				UpperCAmelCase       ):
					SCREAMING_SNAKE_CASE			    =    ['''image_processor''', '''tokenizer''']
					SCREAMING_SNAKE_CASE			    =    '''BlipImageProcessor'''
					SCREAMING_SNAKE_CASE			    =    '''AutoTokenizer'''

					def __init__(	self					:     Union[str, Any]   ,					__UpperCamelCase					:     List[Any]   ,					__UpperCamelCase					:     List[str]   ):
												lowerCamelCase_							  =					False
												super().__init__(__UpperCamelCase   ,					__UpperCamelCase   )
												lowerCamelCase_							  =					self.image_processor

					def __call__(	self					:     Any   ,					__UpperCamelCase					:     ImageInput = None   ,					__UpperCamelCase					:     Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None   ,					__UpperCamelCase					:     bool = True   ,					__UpperCamelCase					:     Union[bool, str, PaddingStrategy] = False   ,					__UpperCamelCase					:     Union[bool, str, TruncationStrategy] = None   ,					__UpperCamelCase					:     Optional[int] = None   ,					__UpperCamelCase					:     int = 0   ,					__UpperCamelCase					:     Optional[int] = None   ,					__UpperCamelCase					:     Optional[bool] = None   ,					__UpperCamelCase					:     bool = False   ,					__UpperCamelCase					:     bool = False   ,					__UpperCamelCase					:     bool = False   ,					__UpperCamelCase					:     bool = False   ,					__UpperCamelCase					:     bool = False   ,					__UpperCamelCase					:     bool = True   ,					__UpperCamelCase					:     Optional[Union[str, TensorType]] = None   ,					**__UpperCamelCase					:     Optional[Any]   ,					):
												if images is None and text is None:
																			raise ValueError("""You have to specify either images or text."""   )

												# Get only text
												if images is None:
																			lowerCamelCase_							  =					self.tokenizer
																			lowerCamelCase_							  =					self.tokenizer(
																			    text=__UpperCamelCase   ,					add_special_tokens=__UpperCamelCase   ,					padding=__UpperCamelCase   ,					truncation=__UpperCamelCase   ,					max_length=__UpperCamelCase   ,					stride=__UpperCamelCase   ,					pad_to_multiple_of=__UpperCamelCase   ,					return_attention_mask=__UpperCamelCase   ,					return_overflowing_tokens=__UpperCamelCase   ,					return_special_tokens_mask=__UpperCamelCase   ,					return_offsets_mapping=__UpperCamelCase   ,					return_token_type_ids=__UpperCamelCase   ,					return_length=__UpperCamelCase   ,					verbose=__UpperCamelCase   ,					return_tensors=__UpperCamelCase   ,					**__UpperCamelCase   ,					)
																			return text_encoding

												# add pixel_values
												lowerCamelCase_							  =					self.image_processor(__UpperCamelCase   ,					return_tensors=__UpperCamelCase   )

												if text is not None:
																			lowerCamelCase_							  =					self.tokenizer(
																			    text=__UpperCamelCase   ,					add_special_tokens=__UpperCamelCase   ,					padding=__UpperCamelCase   ,					truncation=__UpperCamelCase   ,					max_length=__UpperCamelCase   ,					stride=__UpperCamelCase   ,					pad_to_multiple_of=__UpperCamelCase   ,					return_attention_mask=__UpperCamelCase   ,					return_overflowing_tokens=__UpperCamelCase   ,					return_special_tokens_mask=__UpperCamelCase   ,					return_offsets_mapping=__UpperCamelCase   ,					return_token_type_ids=__UpperCamelCase   ,					return_length=__UpperCamelCase   ,					verbose=__UpperCamelCase   ,					return_tensors=__UpperCamelCase   ,					**__UpperCamelCase   ,					)
												else:
																			lowerCamelCase_							  =					None

												if text_encoding is not None:
																			encoding_image_processor.update(__UpperCamelCase   )

												return encoding_image_processor

					def    lowercase__      (	self					:     Any   ,					*__UpperCamelCase					:     Union[str, Any]   ,					**__UpperCamelCase					:     List[Any]   ):
												return self.tokenizer.batch_decode(*__UpperCamelCase   ,					**__UpperCamelCase   )

					def    lowercase__      (	self					:     List[str]   ,					*__UpperCamelCase					:     List[Any]   ,					**__UpperCamelCase					:     int   ):
												return self.tokenizer.decode(*__UpperCamelCase   ,					**__UpperCamelCase   )



					@property
					# Copied from transformers.models.blip.processing_blip.BlipProcessor.model_input_names
					def    lowercase__      (	self					:     Optional[int]   ):
												lowerCamelCase_							  =					self.tokenizer.model_input_names
												lowerCamelCase_							  =					self.image_processor.model_input_names
												return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names   )   )





