code: 
  
  
  '''simple docstring'''
  
  
  
  
  
  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 			a      (      SCREAMING_SNAKE_CASE__   ):
  		__lowercase													=		DPRContextEncoderTokenizer
  		__lowercase													=		DPRContextEncoderTokenizerFast
  		__lowercase													=		True
  
  
  
  
  
  
  
  @require_tokenizers
  class 			a      (      SCREAMING_SNAKE_CASE__   ):
  		__lowercase													=		DPRQuestionEncoderTokenizer
  		__lowercase													=		DPRQuestionEncoderTokenizerFast
  		__lowercase													=		True
  
  
  
  
  
  
  
  @require_tokenizers
  class 			a      (      SCREAMING_SNAKE_CASE__   ):
  		__lowercase													=		DPRReaderTokenizer
  		__lowercase													=		DPRReaderTokenizerFast
  		__lowercase													=		True
  
  
  
  
  
  
  		@slow
  		def       lowerCAmelCase_  (  self							)->			Optional[Any]:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=self.tokenizer_class.from_pretrained('''bert-base-uncased'''							)
  
  						A__     :							Any   				=tokenizer.encode('''question sequence'''	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							Optional[int]   				=tokenizer.encode('''title sequence'''	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							Optional[Any]   				=tokenizer.encode('''text sequence ''' * 4	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							Tuple   				=[[1_01] + text_a + [1_02] + text_a + [1_02] + text_a]
  						A__     :							str   				=BatchEncoding({'''input_ids''': input_ids}							)
  
  						A__     :							List[Any]   				=[[0] * len(input_ids[0]							)]
  						A__     :							Optional[int]   				=[[0] * len(input_ids[0]							)]
  						A__     :							Optional[Any]   				=[0]
  						A__     :							Optional[int]   				=DPRReaderOutput(__UpperCamelCase	,     __UpperCamelCase	,     __UpperCamelCase							)
  
  						A__				,  A__     :							Optional[int]   				=8, 9
  						A__     :							Optional[int]   				=10
  						A__     :							Optional[int]   				=10
  						A__     :							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							)->			Dict:
  						'''simple docstring'''
  
  
  						A__     :							Dict   				=self.tokenizer_class.from_pretrained('''bert-base-uncased'''							)
  
  						A__     :							Optional[int]   				=tokenizer.encode('''question sequence'''	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							int   				=tokenizer.encode('''title sequence'''	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							Union[str, Any]   				=tokenizer.encode('''text sequence'''	,     add_special_tokens=__UpperCamelCase							)
  						A__     :							Optional[int]   				=[1_01] + text_a + [1_02] + text_a + [1_02] + text_a
  						A__     :							Optional[int]   				=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: 
  
  
  from dataclasses import dataclass
  from enum import Enum
  from typing import List, Optional, Union
  
  import numpy as np
  import PIL
  from PIL import Image
  
  from ...utils import BaseOutput, is_torch_available, is_transformers_available
  
  
  
  @dataclass
  class 			a      (      UpperCamelCase_   ):
  		__lowercase													=		{
  		    """sld_warmup_steps""": 15,
  		    """sld_guidance_scale""": 20,
  		    """sld_threshold""": 0.0,
  		    """sld_momentum_scale""": 0.0,
  		    """sld_mom_beta""": 0.0,
  		}
  		__lowercase													=		{
  		    """sld_warmup_steps""": 10,
  		    """sld_guidance_scale""": 1_000,
  		    """sld_threshold""": 0.01,
  		    """sld_momentum_scale""": 0.3,
  		    """sld_mom_beta""": 0.4,
  		}
  		__lowercase													=		{
  		    """sld_warmup_steps""": 7,
  		    """sld_guidance_scale""": 2_000,
  		    """sld_threshold""": 0.0_25,
  		    """sld_momentum_scale""": 0.5,
  		    """sld_mom_beta""": 0.7,
  		}
  		__lowercase													=		{
  		    """sld_warmup_steps""": 0,
  		    """sld_guidance_scale""": 5_000,
  		    """sld_threshold""": 1.0,
  		    """sld_momentum_scale""": 0.5,
  		    """sld_mom_beta""": 0.7,
  		}
  
  
  
  
  
  
  
  @dataclass
  class 			a      (      UpperCamelCase_   ):
  		__lowercase													=		42
  		__lowercase													=		42
  		__lowercase													=		42
  		__lowercase													=		42
  
  
  if is_transformers_available() and is_torch_available():
  						from .pipeline_stable_diffusion_safe import StableDiffusionPipelineSafe
  						from .safety_checker import SafeStableDiffusionSafetyChecker
  
  
  
  