code: 
  
  
  from transformers import (
      DPRContextEncoderTokenizer,
      DPRContextEncoderTokenizerFast,
      DPRQuestionEncoderTokenizer,
      DPRQuestionEncoderTokenizerFast,
      DPRReaderOutput,
      DPRReaderTokenizer,
      DPRReaderTokenizerFast,
  )
  from transformers.testing_utils import require_tokenizers, slow
  from transformers.tokenization_utils_base import BatchEncoding
  
  from ..bert.test_tokenization_bert import BertTokenizationTest
  
  @require_tokenizers
  class 					UpperCAmelCase__   (      __lowerCamelCase		):
  
  
  
       '''simple docstring'''
       UpperCAmelCase_         =  DPRContextEncoderTokenizer
       UpperCAmelCase_         =  DPRContextEncoderTokenizerFast
       UpperCAmelCase_         =  True
  
  
  
  
  @require_tokenizers
  class 					UpperCAmelCase__   (      __lowerCamelCase		):
  
  
  
       '''simple docstring'''
       UpperCAmelCase_         =  DPRQuestionEncoderTokenizer
       UpperCAmelCase_         =  DPRQuestionEncoderTokenizerFast
       UpperCAmelCase_         =  True
  
  
  
  
  @require_tokenizers
  class 					UpperCAmelCase__   (      __lowerCamelCase		):
  
  
  
       '''simple docstring'''
       UpperCAmelCase_         =  DPRReaderTokenizer
       UpperCAmelCase_         =  DPRReaderTokenizerFast
       UpperCAmelCase_         =  True
  
  
  
  
       @slow
       def   lowerCAmelCase_   ( self       :       Optional[int]		):
  
  
  
  
  
              """simple docstring"""
  
  
  
              _lowercase					:				List[str]           =			self.tokenizer_class.from_pretrained('''bert-base-uncased'''		)
  
              _lowercase					:				Optional[int]           =			tokenizer.encode('''question sequence'''	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Union[str, Any]           =			tokenizer.encode('''title sequence'''	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Any           =			tokenizer.encode('''text sequence ''' * 4	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Dict           =			[[1_01] + text_a + [1_02] + text_a + [1_02] + text_a]
              _lowercase					:				List[Any]           =			BatchEncoding({'''input_ids''': input_ids}		)
  
              _lowercase					:				Any           =			[[0] * len(input_ids[0]		)]
              _lowercase					:				Optional[int]           =			[[0] * len(input_ids[0]		)]
              _lowercase					:				Dict           =			[0]
              _lowercase					:				Optional[Any]           =			DPRReaderOutput(UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase		)
  
              _lowercase       ,	_lowercase					:				Dict           =			8, 9
              _lowercase					:				Dict           =			10
              _lowercase					:				Dict           =			10
              _lowercase					:				Optional[Any]           =			tokenizer.decode_best_spans(UpperCamelCase	,      UpperCamelCase		)
              self.assertEqual(predicted_spans[0].start_index	,      UpperCamelCase		)
              self.assertEqual(predicted_spans[0].end_index	,      UpperCamelCase		)
              self.assertEqual(predicted_spans[0].doc_id	,      0		)
  
  
  
  
       @slow
       def   lowerCAmelCase_   ( self       :       Tuple		):
  
  
  
  
  
              """simple docstring"""
  
  
  
              _lowercase					:				List[str]           =			self.tokenizer_class.from_pretrained('''bert-base-uncased'''		)
  
              _lowercase					:				List[str]           =			tokenizer.encode('''question sequence'''	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Optional[int]           =			tokenizer.encode('''title sequence'''	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Any           =			tokenizer.encode('''text sequence'''	,      add_special_tokens=UpperCamelCase		)
              _lowercase					:				Tuple           =			[1_01] + text_a + [1_02] + text_a + [1_02] + text_a
              _lowercase					:				List[str]           =			tokenizer(questions=['''question sequence''']	,      titles=['''title sequence''']	,      texts=['''text sequence''']		)
              self.assertIn('''input_ids'''	,      UpperCamelCase		)
              self.assertIn('''attention_mask'''	,      UpperCamelCase		)
              self.assertListEqual(encoded_input['''input_ids'''][0]	,      UpperCamelCase		)
style_context: 
  
  
  # limitations under the License.
  
  
  from typing import Optional, Tuple, Union
  
  import torch
  
  from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
  
  class 						UpperCAmelCase__   (      A_		):
  
  
  
       '''simple docstring'''
  
  
  
  
       def __init__( self       :       List[str]	,      UpperCamelCase       :       Union[str, Any]	,      UpperCamelCase       :       int		):
  
  
  
  
  
              """simple docstring"""
  
  
  
              super().__init__()
              self.register_modules(unet=UpperCamelCase	,      scheduler=UpperCamelCase		)
  
  
  
  
       @torch.no_grad()
       def __call__( self       :       Any	,      UpperCamelCase       :       int = 1	,      UpperCamelCase       :       Optional[torch.Generator] = None	,      UpperCamelCase       :       int = 50	,      UpperCamelCase       :       Optional[str] = "pil"	,      UpperCamelCase       :       bool = True	,      **UpperCamelCase       :       int	,      ):
  
  
  
  
  
              """simple docstring"""
  
  
  
              _lowercase					:				Optional[int]           =			torch.randn(
                  (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)	,      generator=UpperCamelCase	,      )
              _lowercase					:				Dict           =			image.to(self.device		)
  
              # set step values
              self.scheduler.set_timesteps(UpperCamelCase		)
  
              for t in self.progress_bar(self.scheduler.timesteps		):
                     # 1. predict noise model_output
                     _lowercase					:				Dict           =			self.unet(UpperCamelCase	,      UpperCamelCase		).sample
  
                     # 2. predict previous mean of image x_t-1 and add variance depending on eta
                     # eta corresponds to η in paper and should be between [0, 1]
                     # do x_t -> x_t-1
                     _lowercase					:				Tuple           =			self.scheduler.step(UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase		).prev_sample
  
              _lowercase					:				Optional[int]           =			(image / 2 + 0.5).clamp(0	,      1		)
              _lowercase					:				int           =			image.cpu().permute(0	,      2	,      3	,      1		).numpy()
              if output_type == "pil":
                     _lowercase					:				List[Any]           =			self.numpy_to_pil(UpperCamelCase		)
  
              if not return_dict:
                     return (image,), "This is a local test"
  
              return ImagePipelineOutput(images=UpperCamelCase		), "This is a local test"