import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple

import regex as re

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


if TYPE_CHECKING:
      from transformers.pipelines.conversational import Conversation

lowercase_ 				=				logging.get_logger(__name__)


lowercase_ 				=				{
    'vocab_file': 'vocab.json',
    'merges_file': 'merges.txt',
    'tokenizer_config_file': 'tokenizer_config.json',
}

lowercase_ 				=				{
    'vocab_file': {'facebook/blenderbot-3B': 'https://huggingface.co/facebook/blenderbot-3B/resolve/main/vocab.json'},
    'merges_file': {'facebook/blenderbot-3B': 'https://huggingface.co/facebook/blenderbot-3B/resolve/main/merges.txt'},
    'tokenizer_config_file': {
        'facebook/blenderbot-3B': 'https://huggingface.co/facebook/blenderbot-3B/resolve/main/tokenizer_config.json'
    },
}

lowercase_ 				=				{'facebook/blenderbot-3B': 1_2_8}







@lru_cache()
# Copied from transformers.models.roberta.tokenization_roberta.bytes_to_unicode
def 			A__      (	):
 SCREAMING_SNAKE_CASE__:   List[Any]=      (
     list(range(ord('''!'''      )       ,				ord('''~'''      ) + 1      )      ) + list(range(ord('''¡'''      )       ,				ord('''¬'''      ) + 1      )      ) + list(range(ord('''®'''      )       ,				ord('''ÿ'''      ) + 1      )      )
 )
 SCREAMING_SNAKE_CASE__:   List[Any]=      bs[:]
 SCREAMING_SNAKE_CASE__:   Optional[int]=      0
 for b in range(2**8      ):
  if b not in bs:
   bs.append(snake_case_      )
   cs.append(2**8 + n      )
   n += 1
 SCREAMING_SNAKE_CASE__:   Tuple=      [chr(snake_case_      ) for n in cs]
 return dict(zip(snake_case_       ,				snake_case_      )      )







def 			A__      (	snake_case_ :		str      ):
 SCREAMING_SNAKE_CASE__:   List[str]=      set()
 SCREAMING_SNAKE_CASE__:   Dict=      word[0]
 for char in word[1:]:
  pairs.add((prev_char, char)      )
  SCREAMING_SNAKE_CASE__:   Dict=      char
 return pairs






class 		_lowerCamelCase		(   UpperCamelCase_    ):
    __a  =      VOCAB_FILES_NAMES
    __a  =      PRETRAINED_VOCAB_FILES_MAP
    __a  =      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    __a  =      ["input_ids", "attention_mask"]
    def __init__(  self , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase="replace" , lowerCAmelCase="<s>" , lowerCAmelCase="</s>" , lowerCAmelCase="</s>" , lowerCAmelCase="<s>" , lowerCAmelCase="<unk>" , lowerCAmelCase="<pad>" , lowerCAmelCase="<mask>" , lowerCAmelCase=False , **lowerCAmelCase , )       ->					List[str]:
     SCREAMING_SNAKE_CASE__:   Optional[int]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else bos_token
     SCREAMING_SNAKE_CASE__:   List[str]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else eos_token
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else sep_token
     SCREAMING_SNAKE_CASE__:   Tuple=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else cls_token
     SCREAMING_SNAKE_CASE__:   Optional[int]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else unk_token
     SCREAMING_SNAKE_CASE__:   Optional[int]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else pad_token

     # Mask token behave like a normal word, i.e. include the space before it
     SCREAMING_SNAKE_CASE__:   List[str]=      AddedToken(lowerCAmelCase , lstrip=lowerCAmelCase , rstrip=lowerCAmelCase   ) if isinstance(lowerCAmelCase , lowerCAmelCase   ) else mask_token

     super().__init__(
         errors=lowerCAmelCase , bos_token=lowerCAmelCase , eos_token=lowerCAmelCase , unk_token=lowerCAmelCase , sep_token=lowerCAmelCase , cls_token=lowerCAmelCase , pad_token=lowerCAmelCase , mask_token=lowerCAmelCase , add_prefix_space=lowerCAmelCase , **lowerCAmelCase , )

     with open(lowerCAmelCase , encoding='''utf-8'''   ) as vocab_handle:
      SCREAMING_SNAKE_CASE__:   int=      json.load(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Tuple=      {v: k for k, v in self.encoder.items()}
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      errors  # how to handle errors in decoding
     SCREAMING_SNAKE_CASE__:   Tuple=      bytes_to_unicode()
     SCREAMING_SNAKE_CASE__:   int=      {v: k for k, v in self.byte_encoder.items()}
     with open(lowerCAmelCase , encoding='''utf-8'''   ) as merges_handle:
      SCREAMING_SNAKE_CASE__:   List[Any]=      merges_handle.read().split('''\n'''   )[1:-1]
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      [tuple(merge.split()   ) for merge in bpe_merges]
     SCREAMING_SNAKE_CASE__:   List[Any]=      dict(zip(lowerCAmelCase , range(len(lowerCAmelCase   )   )   )   )
     SCREAMING_SNAKE_CASE__:   int=      {}
     SCREAMING_SNAKE_CASE__:   Optional[int]=      add_prefix_space

     # Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      re.compile(r'''\'s|\'t|\'re|\'ve|\'m|\'ll|\'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+'''   )
    @property
    # Copied from transformers.models.roberta.tokenization_roberta.RobertaTokenizer.vocab_size with Roberta->Blenderbot, RoBERTa->Blenderbot
    def 						UpperCamelCase_				(  self   )       ->					List[Any]:
     return len(self.encoder   )
    def 						UpperCamelCase_				(  self   )       ->					Any:
     return dict(self.encoder , **self.added_tokens_encoder   )
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					Tuple:
     if token in self.cache:
      return self.cache[token]
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      tuple(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      get_pairs(lowerCAmelCase   )

     if not pairs:
      return token

     while True:
      SCREAMING_SNAKE_CASE__:   Union[str, Any]=      min(lowerCAmelCase , key=lambda lowerCAmelCase   : self.bpe_ranks.get(lowerCAmelCase , float('''inf'''   )   )   )
      if bigram not in self.bpe_ranks:
       break
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      bigram
      SCREAMING_SNAKE_CASE__:   List[str]=      []
      SCREAMING_SNAKE_CASE__:   Optional[int]=      0
      while i < len(lowerCAmelCase   ):
       try:
        SCREAMING_SNAKE_CASE__:   Union[str, Any]=      word.index(lowerCAmelCase , lowerCAmelCase   )
       except ValueError:
        new_word.extend(word[i:]   )
        break
       else:
        new_word.extend(word[i:j]   )
        SCREAMING_SNAKE_CASE__:   Optional[int]=      j

       if word[i] == first and i < len(lowerCAmelCase   ) - 1 and word[i + 1] == second:
        new_word.append(first + second   )
        i += 2
       else:
        new_word.append(word[i]   )
        i += 1
      SCREAMING_SNAKE_CASE__:   List[Any]=      tuple(lowerCAmelCase   )
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      new_word
      if len(lowerCAmelCase   ) == 1:
       break
      else:
       SCREAMING_SNAKE_CASE__:   Dict=      get_pairs(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   List[str]=      ''' '''.join(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   int=      word
     return word
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					List[Any]:
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      []
     for token in re.findall(self.pat , lowerCAmelCase   ):
      SCREAMING_SNAKE_CASE__:   List[str]=      ''''''.join(
          self.byte_encoder[b] for b in token.encode('''utf-8'''   )   )  # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
      bpe_tokens.extend(bpe_token for bpe_token in self.bpe(lowerCAmelCase   ).split(''' '''   )   )
     return bpe_tokens
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					Dict:
     return self.encoder.get(lowerCAmelCase , self.encoder.get(self.unk_token   )   )
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					Dict:
     return self.decoder.get(lowerCAmelCase   )
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					List[str]:
     SCREAMING_SNAKE_CASE__:   int=      ''''''.join(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   List[Any]=      bytearray([self.byte_decoder[c] for c in text]   ).decode('''utf-8''' , errors=self.errors   )
     return text
    def 						UpperCamelCase_				(  self , lowerCAmelCase , lowerCAmelCase = None   )       ->					Tuple[str]:
     if not os.path.isdir(lowerCAmelCase   ):
      logger.error(f'Vocabulary path ({save_directory}) should be a directory'   )
      return
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      os.path.join(
         lowerCAmelCase , (filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']   )
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      os.path.join(
         lowerCAmelCase , (filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''merges_file''']   )

     with open(lowerCAmelCase , '''w''' , encoding='''utf-8'''   ) as f:
      f.write(json.dumps(self.encoder , indent=2 , sort_keys=lowerCAmelCase , ensure_ascii=lowerCAmelCase   ) + '''\n'''   )

     SCREAMING_SNAKE_CASE__:   Optional[int]=      0
     with open(lowerCAmelCase , '''w''' , encoding='''utf-8'''   ) as writer:
      writer.write('''#version: 0.2\n'''   )
      for bpe_tokens, token_index in sorted(self.bpe_ranks.items() , key=lambda lowerCAmelCase   : kv[1]   ):
       if index != token_index:
        logger.warning(
            f'Saving vocabulary to {merge_file}: BPE merge indices are not consecutive.'
            ''' Please check that the tokenizer is not corrupted!'''   )
        SCREAMING_SNAKE_CASE__:   int=      token_index
       writer.write(''' '''.join(lowerCAmelCase   ) + '''\n'''   )
       index += 1

     return vocab_file, merge_file
    def 						UpperCamelCase_				(  self , lowerCAmelCase , lowerCAmelCase = None , lowerCAmelCase = False   )       ->					List[int]:
     if already_has_special_tokens:
      return super().get_special_tokens_mask(
          token_ids_a=lowerCAmelCase , token_ids_a=lowerCAmelCase , already_has_special_tokens=lowerCAmelCase   )

     if token_ids_a is None:
      return [1] + ([0] * len(lowerCAmelCase   )) + [1]
     return [1] + ([0] * len(lowerCAmelCase   )) + [1, 1] + ([0] * len(lowerCAmelCase   )) + [1]
    def 						UpperCamelCase_				(  self , lowerCAmelCase , lowerCAmelCase = None   )       ->					List[int]:
     SCREAMING_SNAKE_CASE__:   Tuple=      [self.sep_token_id]
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      [self.cls_token_id]

     if token_ids_a is None:
      return len(cls + token_ids_a + sep   ) * [0]
     return len(cls + token_ids_a + sep + sep + token_ids_a + sep   ) * [0]
    def 						UpperCamelCase_				(  self , lowerCAmelCase , lowerCAmelCase=False , **lowerCAmelCase   )       ->					Dict:
     SCREAMING_SNAKE_CASE__:   int=      kwargs.pop('''add_prefix_space''' , self.add_prefix_space   )
     if (is_split_into_words or add_prefix_space) and (len(lowerCAmelCase   ) > 0 and not text[0].isspace()):
      SCREAMING_SNAKE_CASE__:   Dict=      ''' ''' + text
     return (text, kwargs)
    def 						UpperCamelCase_				(  self , lowerCAmelCase , lowerCAmelCase = None   )       ->					Dict:
     return token_ids_a + [self.eos_token_id]



    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					List[int]:
     SCREAMING_SNAKE_CASE__:   int=      []
     for is_user, text in conversation.iter_texts():
      if is_user:
       # We need to space prefix as it's being done within blenderbot
       inputs.append(''' ''' + text   )
      else:
       # Generated responses should contain them already.
       inputs.append(lowerCAmelCase   )

     SCREAMING_SNAKE_CASE__:   List[Any]=      '''  '''.join(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Tuple=      self.encode(lowerCAmelCase   )
     if len(lowerCAmelCase   ) > self.model_max_length:
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      input_ids[-self.model_max_length :]
      logger.warning(f'Trimmed input from conversation as it was longer than {self.model_max_length} tokens.'   )
     return input_ids


lowercase_     :   Optional[int] 				=				'0.18.2'

from .configuration_utils import ConfigMixin
from .utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_inflect_available,
    is_invisible_watermark_available,
    is_k_diffusion_available,
    is_k_diffusion_version,
    is_librosa_available,
    is_note_seq_available,
    is_onnx_available,
    is_scipy_available,
    is_torch_available,
    is_torchsde_available,
    is_transformers_available,
    is_transformers_version,
    is_unidecode_available,
    logging,
)


try:
      if not is_onnx_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_onnx_objects import *  # noqa F403
else:
      from .pipelines import OnnxRuntimeModel

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_pt_objects import *  # noqa F403
else:
      from .models import (
          AutoencoderKL,
          ControlNetModel,
          ModelMixin,
          PriorTransformer,
          TaFilmDecoder,
          TransformeraDModel,
          UNetaDModel,
          UNetaDConditionModel,
          UNetaDModel,
          UNetaDConditionModel,
          VQModel,
      )
      from .optimization import (
          get_constant_schedule,
          get_constant_schedule_with_warmup,
          get_cosine_schedule_with_warmup,
          get_cosine_with_hard_restarts_schedule_with_warmup,
          get_linear_schedule_with_warmup,
          get_polynomial_decay_schedule_with_warmup,
          get_scheduler,
      )
      from .pipelines import (
          AudioPipelineOutput,
          ConsistencyModelPipeline,
          DanceDiffusionPipeline,
          DDIMPipeline,
          DDPMPipeline,
          DiffusionPipeline,
          DiTPipeline,
          ImagePipelineOutput,
          KarrasVePipeline,
          LDMPipeline,
          LDMSuperResolutionPipeline,
          PNDMPipeline,
          RePaintPipeline,
          ScoreSdeVePipeline,
      )
      from .schedulers import (
          CMStochasticIterativeScheduler,
          DDIMInverseScheduler,
          DDIMParallelScheduler,
          DDIMScheduler,
          DDPMParallelScheduler,
          DDPMScheduler,
          DEISMultistepScheduler,
          DPMSolverMultistepInverseScheduler,
          DPMSolverMultistepScheduler,
          DPMSolverSinglestepScheduler,
          EulerAncestralDiscreteScheduler,
          EulerDiscreteScheduler,
          HeunDiscreteScheduler,
          IPNDMScheduler,
          KarrasVeScheduler,
          KDPMaAncestralDiscreteScheduler,
          KDPMaDiscreteScheduler,
          PNDMScheduler,
          RePaintScheduler,
          SchedulerMixin,
          ScoreSdeVeScheduler,
          UnCLIPScheduler,
          UniPCMultistepScheduler,
          VQDiffusionScheduler,
      )
      from .training_utils import EMAModel

try:
      if not (is_torch_available() and is_scipy_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_scipy_objects import *  # noqa F403
else:
      from .schedulers import LMSDiscreteScheduler

try:
      if not (is_torch_available() and is_torchsde_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_torchsde_objects import *  # noqa F403
else:
      from .schedulers import DPMSolverSDEScheduler

try:
      if not (is_torch_available() and is_transformers_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
      from .pipelines import (
          AltDiffusionImgaImgPipeline,
          AltDiffusionPipeline,
          AudioLDMPipeline,
          CycleDiffusionPipeline,
          IFImgaImgPipeline,
          IFImgaImgSuperResolutionPipeline,
          IFInpaintingPipeline,
          IFInpaintingSuperResolutionPipeline,
          IFPipeline,
          IFSuperResolutionPipeline,
          ImageTextPipelineOutput,
          KandinskyImgaImgPipeline,
          KandinskyInpaintPipeline,
          KandinskyPipeline,
          KandinskyPriorPipeline,
          KandinskyVaaControlnetImgaImgPipeline,
          KandinskyVaaControlnetPipeline,
          KandinskyVaaImgaImgPipeline,
          KandinskyVaaInpaintPipeline,
          KandinskyVaaPipeline,
          KandinskyVaaPriorEmbaEmbPipeline,
          KandinskyVaaPriorPipeline,
          LDMTextToImagePipeline,
          PaintByExamplePipeline,
          SemanticStableDiffusionPipeline,
          ShapEImgaImgPipeline,
          ShapEPipeline,
          StableDiffusionAttendAndExcitePipeline,
          StableDiffusionControlNetImgaImgPipeline,
          StableDiffusionControlNetInpaintPipeline,
          StableDiffusionControlNetPipeline,
          StableDiffusionDepthaImgPipeline,
          StableDiffusionDiffEditPipeline,
          StableDiffusionImageVariationPipeline,
          StableDiffusionImgaImgPipeline,
          StableDiffusionInpaintPipeline,
          StableDiffusionInpaintPipelineLegacy,
          StableDiffusionInstructPixaPixPipeline,
          StableDiffusionLatentUpscalePipeline,
          StableDiffusionLDMaDPipeline,
          StableDiffusionModelEditingPipeline,
          StableDiffusionPanoramaPipeline,
          StableDiffusionParadigmsPipeline,
          StableDiffusionPipeline,
          StableDiffusionPipelineSafe,
          StableDiffusionPixaPixZeroPipeline,
          StableDiffusionSAGPipeline,
          StableDiffusionUpscalePipeline,
          StableUnCLIPImgaImgPipeline,
          StableUnCLIPPipeline,
          TextToVideoSDPipeline,
          TextToVideoZeroPipeline,
          UnCLIPImageVariationPipeline,
          UnCLIPPipeline,
          UniDiffuserModel,
          UniDiffuserPipeline,
          UniDiffuserTextDecoder,
          VersatileDiffusionDualGuidedPipeline,
          VersatileDiffusionImageVariationPipeline,
          VersatileDiffusionPipeline,
          VersatileDiffusionTextToImagePipeline,
          VideoToVideoSDPipeline,
          VQDiffusionPipeline,
      )

try:
      if not (is_torch_available() and is_transformers_available() and is_invisible_watermark_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_transformers_and_invisible_watermark_objects import *  # noqa F403
else:
      from .pipelines import StableDiffusionXLImgaImgPipeline, StableDiffusionXLPipeline

try:
      if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_transformers_and_k_diffusion_objects import *  # noqa F403
else:
      from .pipelines import StableDiffusionKDiffusionPipeline

try:
      if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403
else:
      from .pipelines import (
          OnnxStableDiffusionImgaImgPipeline,
          OnnxStableDiffusionInpaintPipeline,
          OnnxStableDiffusionInpaintPipelineLegacy,
          OnnxStableDiffusionPipeline,
          OnnxStableDiffusionUpscalePipeline,
          StableDiffusionOnnxPipeline,
      )

try:
      if not (is_torch_available() and is_librosa_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_torch_and_librosa_objects import *  # noqa F403
else:
      from .pipelines import AudioDiffusionPipeline, Mel

try:
      if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_transformers_and_torch_and_note_seq_objects import *  # noqa F403
else:
      from .pipelines import SpectrogramDiffusionPipeline

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_flax_objects import *  # noqa F403
else:
      from .models.controlnet_flax import FlaxControlNetModel
      from .models.modeling_flax_utils import FlaxModelMixin
      from .models.unet_ad_condition_flax import FlaxUNetaDConditionModel
      from .models.vae_flax import FlaxAutoencoderKL
      from .pipelines import FlaxDiffusionPipeline
      from .schedulers import (
          FlaxDDIMScheduler,
          FlaxDDPMScheduler,
          FlaxDPMSolverMultistepScheduler,
          FlaxKarrasVeScheduler,
          FlaxLMSDiscreteScheduler,
          FlaxPNDMScheduler,
          FlaxSchedulerMixin,
          FlaxScoreSdeVeScheduler,
      )


try:
      if not (is_flax_available() and is_transformers_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_flax_and_transformers_objects import *  # noqa F403
else:
      from .pipelines import (
          FlaxStableDiffusionControlNetPipeline,
          FlaxStableDiffusionImgaImgPipeline,
          FlaxStableDiffusionInpaintPipeline,
          FlaxStableDiffusionPipeline,
      )

try:
      if not (is_note_seq_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from .utils.dummy_note_seq_objects import *  # noqa F403
else:
      from .pipelines import MidiProcessor

