code: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  import tempfile
  import unittest
  
  from diffusers import (
      DDIMScheduler,
      DDPMScheduler,
      DPMSolverMultistepScheduler,
      EulerAncestralDiscreteScheduler,
      EulerDiscreteScheduler,
      PNDMScheduler,
      logging,
  )
  from diffusers.configuration_utils import ConfigMixin, register_to_config
  from diffusers.utils.testing_utils import CaptureLogger
  
  
  
  
  
  
  class 						lowercase     (   lowerCAmelCase_):
        __lowercase 		=  'config.json'
  
  
  
  
  
  
        @register_to_config
        def __init__(self ,  a__=2 ,  a__=5 ,  a__=(2, 5) ,  a__="for diffusion" ,  a__=[1, 3] ,  )       ->   Optional[Any]:
           pass
  
  
  
  
  
  
  class 						lowercase     (   lowerCAmelCase_):
        __lowercase 		=  'config.json'
  
  
  
  
  
  
        @register_to_config
        def __init__(self ,  a__=2 ,  a__=5 ,  a__=(2, 5) ,  a__="for diffusion" ,  a__=[1, 3] ,  )       ->   str:
           pass
  
  
  
  
  
  
  class 						lowercase     (   lowerCAmelCase_):
        __lowercase 		=  'config.json'
  
  
  
  
  
  
        @register_to_config
        def __init__(self ,  a__=2 ,  a__=5 ,  a__=(2, 5) ,  a__="for diffusion" ,  a__=[1, 3] ,  a__=[1, 3] ,  )       ->   Dict:
           pass
  
  
  
  
  
  
  class 						lowercase     (   lowerCAmelCase_):
        __lowercase 		=  'config.json'
  
  
  
  
  
  
        @register_to_config
        def __init__(self ,  a__=2 ,  a__=5 ,  a__=(2, 5) ,  a__="for diffusion" ,  a__=[1, 5] ,  a__=[5, 4] ,  )       ->   Any:
           pass
  
  
  
  
  
  
  class 						lowercase     (   unittest.TestCase):
  
  
  
  
  
  
        def    A__(self					)       ->   Union[str, Any]:
  
           with self.assertRaises(lowerCamelCase_					):
              ConfigMixin.load_config('''dummy_path'''					)
  
  
  
  
  
  
        def    A__(self					)       ->   List[str]:
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= SampleObject()
           SCREAMING_SNAKE_CASE__			:				List[str]       						= obj.config
           assert config["a"] == 2
           assert config["b"] == 5
           assert config["c"] == (2, 5)
           assert config["d"] == "for diffusion"
           assert config["e"] == [1, 3]
  
           # init ignore private arguments
           SCREAMING_SNAKE_CASE__			:				str       						= SampleObject(_name_or_path='''lalala'''					)
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= obj.config
           assert config["a"] == 2
           assert config["b"] == 5
           assert config["c"] == (2, 5)
           assert config["d"] == "for diffusion"
           assert config["e"] == [1, 3]
  
           # can override default
           SCREAMING_SNAKE_CASE__			:				List[str]       						= SampleObject(c=6					)
           SCREAMING_SNAKE_CASE__			:				int       						= obj.config
           assert config["a"] == 2
           assert config["b"] == 5
           assert config["c"] == 6
           assert config["d"] == "for diffusion"
           assert config["e"] == [1, 3]
  
           # can use positional arguments.
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= SampleObject(1 ,  c=6					)
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= obj.config
           assert config["a"] == 1
           assert config["b"] == 5
           assert config["c"] == 6
           assert config["d"] == "for diffusion"
           assert config["e"] == [1, 3]
  
  
  
  
  
  
        def    A__(self					)       ->   Tuple:
           SCREAMING_SNAKE_CASE__			:				int       						= SampleObject()
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= obj.config
  
           assert config["a"] == 2
           assert config["b"] == 5
           assert config["c"] == (2, 5)
           assert config["d"] == "for diffusion"
           assert config["e"] == [1, 3]
  
           with tempfile.TemporaryDirectory() as tmpdirname:
              obj.save_config(lowerCamelCase_					)
              SCREAMING_SNAKE_CASE__			:				List[str]       						= SampleObject.from_config(SampleObject.load_config(lowerCamelCase_					)					)
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= new_obj.config
  
           # unfreeze configs
           SCREAMING_SNAKE_CASE__			:				int       						= dict(lowerCamelCase_					)
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= dict(lowerCamelCase_					)
  
           assert config.pop('''c'''					) == (2, 5)  # instantiated as tuple
           assert new_config.pop('''c'''					) == [2, 5]  # saved & loaded as list because of json
           config.pop('''_use_default_values'''					)
           assert config == new_config
  
  
  
  
  
  
        def    A__(self					)       ->   List[Any]:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				Dict       						= DDIMScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler'''					)
  
           assert ddim.__class__ == DDIMScheduler
           # no warning should be thrown
           assert cap_logger.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   Union[str, Any]:
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				int       						= EulerDiscreteScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler'''					)
  
           assert euler.__class__ == EulerDiscreteScheduler
           # no warning should be thrown
           assert cap_logger.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   Union[str, Any]:
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				Any       						= EulerAncestralDiscreteScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler'''					)
  
           assert euler.__class__ == EulerAncestralDiscreteScheduler
           # no warning should be thrown
           assert cap_logger.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   List[str]:
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				Tuple       						= PNDMScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler'''					)
  
           assert pndm.__class__ == PNDMScheduler
           # no warning should be thrown
           assert cap_logger.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   List[Any]:
           SCREAMING_SNAKE_CASE__			:				Any       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				List[Any]       						= DDPMScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler''' ,  prediction_type='''sample''' ,  beta_end=8 ,  )
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger_a:
              SCREAMING_SNAKE_CASE__			:				Any       						= DDPMScheduler.from_pretrained('''google/ddpm-celebahq-256''' ,  beta_start=8_8					)
  
           assert ddpm.__class__ == DDPMScheduler
           assert ddpm.config.prediction_type == "sample"
           assert ddpm.config.beta_end == 8
           assert ddpm_a.config.beta_start == 8_8
  
           # no warning should be thrown
           assert cap_logger.out == ""
           assert cap_logger_a.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   List[str]:
           SCREAMING_SNAKE_CASE__			:				str       						= logging.get_logger('''diffusers.configuration_utils'''					)
           # 30 for warning
           logger.setLevel(3_0					)
  
           with CaptureLogger(lowerCamelCase_					) as cap_logger:
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= DPMSolverMultistepScheduler.from_pretrained(
                  '''hf-internal-testing/tiny-stable-diffusion-torch''' ,  subfolder='''scheduler'''					)
  
           assert dpm.__class__ == DPMSolverMultistepScheduler
           # no warning should be thrown
           assert cap_logger.out == ""
  
  
  
  
  
  
        def    A__(self					)       ->   Union[str, Any]:
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= SampleObject()
  
           SCREAMING_SNAKE_CASE__			:				int       						= {k: v for k, v in config.config.items() if not k.startswith('''_'''					)}
  
           # make sure that default config has all keys in `_use_default_values`
           assert set(config_dict.keys()					) == set(config.config._use_default_values					)
  
           with tempfile.TemporaryDirectory() as tmpdirname:
              config.save_config(lowerCamelCase_					)
  
              # now loading it with SampleObject2 should put f into `_use_default_values`
              SCREAMING_SNAKE_CASE__			:				Tuple       						= SampleObjecta.from_config(lowerCamelCase_					)
  
              assert "f" in config._use_default_values
              assert config.f == [1, 3]
  
           # now loading the config, should **NOT** use [1, 3] for `f`, but the default [1, 4] value
           # **BECAUSE** it is part of `config._use_default_values`
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= SampleObjecta.from_config(config.config					)
           assert new_config.f == [5, 4]
  
           config.config._use_default_values.pop()
           SCREAMING_SNAKE_CASE__			:				Tuple       						= SampleObjecta.from_config(config.config					)
           assert new_config_a.f == [1, 3]
  
           # Nevertheless "e" should still be correctly loaded to [1, 3] from SampleObject2 instead of defaulting to [1, 5]
           assert new_config_a.e == [1, 3]
  
  
style_context: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  import json
  from typing import List, Optional, Tuple
  
  from tokenizers import normalizers
  
  from ...tokenization_utils_fast import PreTrainedTokenizerFast
  from ...utils import logging
  from .tokenization_splinter import SplinterTokenizer
  
  
  lowercase__			=	logging.get_logger(__name__)
  
  lowercase__			=	{'''vocab_file''': '''vocab.txt'''}
  
  lowercase__			=	{
      '''vocab_file''': {
          '''tau/splinter-base''': '''https://huggingface.co/tau/splinter-base/resolve/main/vocab.txt''',
          '''tau/splinter-base-qass''': '''https://huggingface.co/tau/splinter-base-qass/resolve/main/vocab.txt''',
          '''tau/splinter-large''': '''https://huggingface.co/tau/splinter-large/resolve/main/vocab.txt''',
          '''tau/splinter-large-qass''': '''https://huggingface.co/tau/splinter-large-qass/resolve/main/vocab.txt''',
      }
  }
  
  lowercase__			=	{
      '''tau/splinter-base''': 5_1_2,
      '''tau/splinter-base-qass''': 5_1_2,
      '''tau/splinter-large''': 5_1_2,
      '''tau/splinter-large-qass''': 5_1_2,
  }
  
  lowercase__			=	{
      '''tau/splinter-base''': {'''do_lower_case''': False},
      '''tau/splinter-base-qass''': {'''do_lower_case''': False},
      '''tau/splinter-large''': {'''do_lower_case''': False},
      '''tau/splinter-large-qass''': {'''do_lower_case''': False},
  }
  
  
  
  
  
  
  class 						lowercase     (   UpperCAmelCase_):
        __lowercase 		=  VOCAB_FILES_NAMES
        __lowercase 		=  PRETRAINED_VOCAB_FILES_MAP
        __lowercase 		=  PRETRAINED_INIT_CONFIGURATION
        __lowercase 		=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
        __lowercase 		=  SplinterTokenizer
  
  
  
  
  
  
        def __init__(self ,  a__=None ,  a__=None ,  a__=True ,  a__="[UNK]" ,  a__="[SEP]" ,  a__="[PAD]" ,  a__="[CLS]" ,  a__="[MASK]" ,  a__="[QUESTION]" ,  a__=True ,  a__=None ,  **a__ ,  )       ->   Any:
           super().__init__(
               a__ ,  tokenizer_file=a__ ,  do_lower_case=a__ ,  unk_token=a__ ,  sep_token=a__ ,  pad_token=a__ ,  cls_token=a__ ,  mask_token=a__ ,  tokenize_chinese_chars=a__ ,  strip_accents=a__ ,  additional_special_tokens=(question_token,) ,  **a__ ,  )
  
           SCREAMING_SNAKE_CASE__			:				Tuple       						= json.loads(self.backend_tokenizer.normalizer.__getstate__()					)
           if (
               pre_tok_state.get('''lowercase''' ,  a__					) != do_lower_case
               or pre_tok_state.get('''strip_accents''' ,  a__					) != strip_accents
           ):
              SCREAMING_SNAKE_CASE__			:				List[Any]       						= getattr(a__ ,  pre_tok_state.pop('''type'''					)					)
              SCREAMING_SNAKE_CASE__			:				Optional[int]       						= do_lower_case
              SCREAMING_SNAKE_CASE__			:				Optional[int]       						= strip_accents
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= pre_tok_class(**a__					)
  
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= do_lower_case
  
  
  
  
  
  
        @property
        def    A__(self					)       ->   List[str]:
           return self.convert_tokens_to_ids(self.question_token					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ = None					)       ->   List[int]:
           if token_ids_a is None:
              return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
  
           SCREAMING_SNAKE_CASE__			:				Dict       						= [self.cls_token_id]
           SCREAMING_SNAKE_CASE__			:				Tuple       						= [self.sep_token_id]
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= [self.question_token_id] + [self.convert_tokens_to_ids('''.'''					)]
           if self.padding_side == "right":
              # Input is question-then-context
              return cls + token_ids_a + question_suffix + sep + token_ids_a + sep
           else:
              # Input is context-then-question
              return cls + token_ids_a + sep + token_ids_a + question_suffix + sep
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ = None					)       ->   List[int]:
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= [self.sep_token_id]
           SCREAMING_SNAKE_CASE__			:				Any       						= [self.cls_token_id]
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= [self.question_token_id] + [self.convert_tokens_to_ids('''.'''					)]
           if token_ids_a is None:
              return len(cls + token_ids_a + sep					) * [0]
  
           if self.padding_side == "right":
              # Input is question-then-context
              return len(cls + token_ids_a + question_suffix + sep					) * [0] + len(token_ids_a + sep					) * [1]
           else:
              # Input is context-then-question
              return len(cls + token_ids_a + sep					) * [0] + len(token_ids_a + question_suffix + sep					) * [1]
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ = None					)       ->   Tuple[str]:
           SCREAMING_SNAKE_CASE__			:				int       						= self._tokenizer.model.save(a__ ,  name=a__					)
           return tuple(a__					)
  
  