code: 
  
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  
  
  import os
  import unittest
  
  from transformers.models.bertweet.tokenization_bertweet import VOCAB_FILES_NAMES, BertweetTokenizer
  
  from ...test_tokenization_common import TokenizerTesterMixin
  
  
  
  
  
  class 					_UpperCAmelCase							(		lowerCAmelCase_			,      unittest.TestCase     ):
  		a     :     int     						=BertweetTokenizer
  		a     :     Any     						=False
  		def 						lowerCamelCase__    (						self    ):
  
  
  
  					'''simple docstring'''
  
  					super().setUp()
  
  					# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
  					__lowerCAmelCase      		=       ["""I""", """m""", """V@@""", """R@@""", """r""", """e@@"""]
  					__lowerCAmelCase      		=       dict(zip(__SCREAMING_SNAKE_CASE,range(len(__SCREAMING_SNAKE_CASE    )    )    )    )
  					__lowerCAmelCase      		=       ["""#version: 0.2""", """a m</w>"""]
  					__lowerCAmelCase      		=       {"""unk_token""": """<unk>"""}
  
  					__lowerCAmelCase      		=       os.path.join(self.tmpdirname,VOCAB_FILES_NAMES["""vocab_file"""]    )
  					__lowerCAmelCase      		=       os.path.join(self.tmpdirname,VOCAB_FILES_NAMES["""merges_file"""]    )
  					with open(self.vocab_file,"""w""",encoding="""utf-8"""    ) as fp:
  								for token in vocab_tokens:
  											fp.write(f'{token} {vocab_tokens[token]}\n'    )
  					with open(self.merges_file,"""w""",encoding="""utf-8"""    ) as fp:
  								fp.write("""\n""".join(__SCREAMING_SNAKE_CASE    )    )
  		def 						lowerCamelCase__    (						self,**__SCREAMING_SNAKE_CASE    ):
  
  
  
  					'''simple docstring'''
  
  					kwargs.update(self.special_tokens_map    )
  					return BertweetTokenizer.from_pretrained(self.tmpdirname,**__SCREAMING_SNAKE_CASE    )
  		def 						lowerCamelCase__    (						self,__SCREAMING_SNAKE_CASE    ):
  
  
  
  					'''simple docstring'''
  
  					__lowerCAmelCase      		=       """I am VinAI Research"""
  					__lowerCAmelCase      		=       """I <unk> m V<unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>"""
  					return input_text, output_text
  
  
  
  
  
  
  
  		def 						lowerCamelCase__    (						self    ):
  
  
  
  					'''simple docstring'''
  
  					__lowerCAmelCase      		=       BertweetTokenizer(self.vocab_file,self.merges_file,**self.special_tokens_map    )
  					__lowerCAmelCase      		=       """I am VinAI Research"""
  					__lowerCAmelCase      		=       """I a@@ m V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h""".split()
  					__lowerCAmelCase      		=       tokenizer.tokenize(__SCREAMING_SNAKE_CASE    )
  					self.assertListEqual(__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE    )
  
  					__lowerCAmelCase      		=       tokens + [tokenizer.unk_token]
  
  					__lowerCAmelCase      		=       [4, 3, 5, 6, 3, 3, 3, 4, 7, 9, 3, 9, 3, 3, 3, 3, 3]
  					self.assertListEqual(tokenizer.convert_tokens_to_ids(__SCREAMING_SNAKE_CASE    ),__SCREAMING_SNAKE_CASE    )
  
  
style_context: 
  
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  
  
  from cva import destroyAllWindows, imread, imshow, waitKey
  
  
  
  
  
  def      _lowerCAmelCase		(		lowercase      ,			lowercase			)      ->      int:
  			__lowerCAmelCase		, __lowerCAmelCase      		=       img.shape[0], img.shape[1]
  
  			def to_grayscale(lowercase      ,			lowercase      ,			lowercase			):
  						return 0.21_26 * red + 0.5_87 * green + 0.1_14 * blue
  
  			def normalize(lowercase			):
  						return min(lowercase      ,			255			)
  
  			for i in range(lowercase			):
  						for j in range(lowercase			):
  									__lowerCAmelCase      		=       int(to_grayscale(*img[i][j]			)			)
  									__lowerCAmelCase      		=       [
  									    normalize(lowercase			),
  									    normalize(greyscale + factor			),
  									    normalize(greyscale + 2 * factor			),
  									]
  
  			return img
  
  
  if __name__ == "__main__":
  	# read original image
  	_a      :				Any											=					{
  	    percentage: imread("""image_data/lena.jpg""", 1) for percentage in (1_0, 2_0, 3_0, 4_0)
  	}
  
  	for percentage, img in images.items():
  		make_sepia(img, percentage)
  
  	for percentage, img in images.items():
  		imshow(f'Original image with sepia (factor: {percentage})', img)
  
  	waitKey(0)
  	destroyAllWindows()
  
  