code: 
  import torch
  
  from diffusers import EulerAncestralDiscreteScheduler
  from diffusers.utils import torch_device
  
  from .test_schedulers import SchedulerCommonTest
  
  
  
  
  class      __lowercase	(	__snake_case					):
   _A   			=      (EulerAncestralDiscreteScheduler,)
   _A   			=      10
  
  
  
  
  
  
   def 			_a(self							:   Any			,  **snake_case							:   Any						)   -> Optional[Any]:
         _lowercase					:  Any    			=      {
             "num_train_timesteps": 1100,
             "beta_start": 0.00_01,
             "beta_end": 0.02,
             "beta_schedule": "linear",
         }
  
         config.update(**snake_case						)
         return config
  
  
  
  
  
  
   def 			_a(self							:   Dict						)   -> Union[str, Any]:
         for timesteps in [10, 50, 100, 1000]:
               self.check_over_configs(num_train_timesteps=snake_case						)
  
  
  
  
  
  
   def 			_a(self							:   int						)   -> int:
         for beta_start, beta_end in zip([0.0_00_01, 0.00_01, 0.0_01]			,  [0.00_02, 0.0_02, 0.02]						):
               self.check_over_configs(beta_start=snake_case			,  beta_end=snake_case						)
  
  
  
  
  
  
   def 			_a(self							:   Optional[int]						)   -> Optional[Any]:
         for schedule in ["linear", "scaled_linear"]:
               self.check_over_configs(beta_schedule=snake_case						)
  
  
  
  
  
  
   def 			_a(self							:   Dict						)   -> Optional[Any]:
         for prediction_type in ["epsilon", "v_prediction"]:
               self.check_over_configs(prediction_type=snake_case						)
  
  
  
  
  
  
   def 			_a(self							:   List[str]						)   -> Union[str, Any]:
         _lowercase					:  List[str]    			=      self.scheduler_classes[0]
         _lowercase					:  List[str]    			=      self.get_scheduler_config()
         _lowercase					:  Optional[Any]    			=      scheduler_class(**snake_case						)
  
         scheduler.set_timesteps(self.num_inference_steps						)
  
         _lowercase					:  Optional[int]    			=      torch.manual_seed(0						)
  
         _lowercase					:  Any    			=      self.dummy_model()
         _lowercase					:  List[Any]    			=      self.dummy_sample_deter * scheduler.init_noise_sigma.cpu()
         _lowercase					:  Any    			=      sample.to(snake_case						)
  
         for i, t in enumerate(scheduler.timesteps						):
               _lowercase					:  int    			=      scheduler.scale_model_input(snake_case			,  snake_case						)
  
               _lowercase					:  List[str]    			=      model(snake_case			,  snake_case						)
  
               _lowercase					:  List[str]    			=      scheduler.step(snake_case			,  snake_case			,  snake_case			,  generator=snake_case						)
               _lowercase					:  Any    			=      output.prev_sample
  
         _lowercase					:  Union[str, Any]    			=      torch.sum(torch.abs(snake_case						)						)
         _lowercase					:  Union[str, Any]    			=      torch.mean(torch.abs(snake_case						)						)
  
         assert abs(result_sum.item() - 152.3192						) < 1e-2
         assert abs(result_mean.item() - 0.19_83						) < 1e-3
  
  
  
  
  
  
   def 			_a(self							:   List[str]						)   -> Tuple:
         _lowercase					:  Union[str, Any]    			=      self.scheduler_classes[0]
         _lowercase					:  Dict    			=      self.get_scheduler_config(prediction_type="v_prediction"						)
         _lowercase					:  Any    			=      scheduler_class(**snake_case						)
  
         scheduler.set_timesteps(self.num_inference_steps						)
  
         _lowercase					:  int    			=      torch.manual_seed(0						)
  
         _lowercase					:  List[Any]    			=      self.dummy_model()
         _lowercase					:  Tuple    			=      self.dummy_sample_deter * scheduler.init_noise_sigma
         _lowercase					:  int    			=      sample.to(snake_case						)
  
         for i, t in enumerate(scheduler.timesteps						):
               _lowercase					:  List[str]    			=      scheduler.scale_model_input(snake_case			,  snake_case						)
  
               _lowercase					:  str    			=      model(snake_case			,  snake_case						)
  
               _lowercase					:  str    			=      scheduler.step(snake_case			,  snake_case			,  snake_case			,  generator=snake_case						)
               _lowercase					:  Union[str, Any]    			=      output.prev_sample
  
         _lowercase					:  Any    			=      torch.sum(torch.abs(snake_case						)						)
         _lowercase					:  str    			=      torch.mean(torch.abs(snake_case						)						)
  
         assert abs(result_sum.item() - 108.4439						) < 1e-2
         assert abs(result_mean.item() - 0.14_12						) < 1e-3
  
  
  
  
  
  
   def 			_a(self							:   List[str]						)   -> Union[str, Any]:
         _lowercase					:  Optional[int]    			=      self.scheduler_classes[0]
         _lowercase					:  int    			=      self.get_scheduler_config()
         _lowercase					:  Dict    			=      scheduler_class(**snake_case						)
  
         scheduler.set_timesteps(self.num_inference_steps			,  device=snake_case						)
         _lowercase					:  Any    			=      torch.manual_seed(0						)
  
         _lowercase					:  Union[str, Any]    			=      self.dummy_model()
         _lowercase					:  int    			=      self.dummy_sample_deter * scheduler.init_noise_sigma.cpu()
         _lowercase					:  Dict    			=      sample.to(snake_case						)
  
         for t in scheduler.timesteps:
               _lowercase					:  Optional[Any]    			=      scheduler.scale_model_input(snake_case			,  snake_case						)
  
               _lowercase					:  List[Any]    			=      model(snake_case			,  snake_case						)
  
               _lowercase					:  Optional[Any]    			=      scheduler.step(snake_case			,  snake_case			,  snake_case			,  generator=snake_case						)
               _lowercase					:  Optional[Any]    			=      output.prev_sample
  
         _lowercase					:  Any    			=      torch.sum(torch.abs(snake_case						)						)
         _lowercase					:  Optional[int]    			=      torch.mean(torch.abs(snake_case						)						)
  
         assert abs(result_sum.item() - 152.3192						) < 1e-2
         assert abs(result_mean.item() - 0.19_83						) < 1e-3
  
  
  
  
  
style_context: 
  import os
  import unittest
  
  from transformers.models.bertweet.tokenization_bertweet import VOCAB_FILES_NAMES, BertweetTokenizer
  
  from ...test_tokenization_common import TokenizerTesterMixin
  
  
  
  
  class      __lowercase	(	__snake_case      ,   unittest.TestCase					):
  	_A   			=      BertweetTokenizer
  	_A   			=      False
  
  
  
  
  
  
  	def 			_a(self							:   Tuple						)   -> Any:
  							super().setUp()
  
  							# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
  							_lowercase					:  Tuple    			=      ["I", "m", "V@@", "R@@", "r", "e@@"]
  							_lowercase					:  Tuple    			=      dict(zip(snake_case			,  range(len(snake_case						)						)						)						)
  							_lowercase					:  Tuple    			=      ["#version: 0.2", "a m</w>"]
  							_lowercase					:  Optional[Any]    			=      {"unk_token": "<unk>"}
  
  							_lowercase					:  int    			=      os.path.join(self.tmpdirname			,  VOCAB_FILES_NAMES["vocab_file"]						)
  							_lowercase					:  Optional[int]    			=      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(snake_case						)						)
  
  
  
  
  
  
  	def 			_a(self							:   List[Any]			,  **snake_case							:   Tuple						)   -> Union[str, Any]:
  							kwargs.update(self.special_tokens_map						)
  							return BertweetTokenizer.from_pretrained(self.tmpdirname			,  **snake_case						)
  
  
  
  
  
  
  	def 			_a(self							:   Any			,  snake_case							:   Any						)   -> List[Any]:
  							_lowercase					:  Tuple    			=      "I am VinAI Research"
  							_lowercase					:  Optional[int]    			=      "I <unk> m V<unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>"
  							return input_text, output_text
  
  
  
  
  
  
  	def 			_a(self							:   str						)   -> Optional[int]:
  							_lowercase					:  str    			=      BertweetTokenizer(self.vocab_file			,  self.merges_file			,  **self.special_tokens_map						)
  							_lowercase					:  Optional[Any]    			=      "I am VinAI Research"
  							_lowercase					:  str    			=      "I a@@ m V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h".split()
  							_lowercase					:  Tuple    			=      tokenizer.tokenize(snake_case						)
  							self.assertListEqual(snake_case			,  snake_case						)
  
  							_lowercase					:  str    			=      tokens + [tokenizer.unk_token]
  
  							_lowercase					:  str    			=      [4, 3, 5, 6, 3, 3, 3, 4, 7, 9, 3, 9, 3, 3, 3, 3, 3]
  							self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case						)			,  snake_case						)
  
  
  
  
  