import json
import os
import unittest

from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin






@require_tokenizers
class 		_lowerCamelCase		(   UpperCamelCase_    ,     unittest.TestCase    ):
    __a  =      CLIPTokenizer
    __a  =      CLIPTokenizerFast
    __a  =      True
    __a  =      {}
    __a  =      False
    def 						UpperCamelCase_				(  self   )       ->					List[Any]:
     super().setUp()

     # fmt: off
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      ['''l''', '''o''', '''w''', '''e''', '''r''', '''s''', '''t''', '''i''', '''d''', '''n''', '''lo''', '''l</w>''', '''w</w>''', '''r</w>''', '''t</w>''', '''low</w>''', '''er</w>''', '''lowest</w>''', '''newer</w>''', '''wider''', '''<unk>''', '''<|startoftext|>''', '''<|endoftext|>''']
     # fmt: on
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      dict(zip(lowerCAmelCase , range(len(lowerCAmelCase   )   )   )   )
     SCREAMING_SNAKE_CASE__:   Tuple=      ['''#version: 0.2''', '''l o''', '''lo w</w>''', '''e r</w>''']
     SCREAMING_SNAKE_CASE__:   List[Any]=      {'''unk_token''': '''<unk>'''}

     SCREAMING_SNAKE_CASE__:   str=      os.path.join(self.tmpdirname , VOCAB_FILES_NAMES['''vocab_file''']   )
     SCREAMING_SNAKE_CASE__:   List[str]=      os.path.join(self.tmpdirname , VOCAB_FILES_NAMES['''merges_file''']   )
     with open(self.vocab_file , '''w''' , encoding='''utf-8'''   ) as fp:
      fp.write(json.dumps(lowerCAmelCase   ) + '''\n'''   )
     with open(self.merges_file , '''w''' , encoding='''utf-8'''   ) as fp:
      fp.write('''\n'''.join(lowerCAmelCase   )   )
    def 						UpperCamelCase_				(  self , **lowerCAmelCase   )       ->					Any:
     kwargs.update(self.special_tokens_map   )
     return CLIPTokenizer.from_pretrained(self.tmpdirname , **lowerCAmelCase   )
    def 						UpperCamelCase_				(  self , **lowerCAmelCase   )       ->					Any:
     kwargs.update(self.special_tokens_map   )
     return CLIPTokenizerFast.from_pretrained(self.tmpdirname , **lowerCAmelCase   )
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					Optional[int]:
     SCREAMING_SNAKE_CASE__:   Dict=      '''lower newer'''
     SCREAMING_SNAKE_CASE__:   List[str]=      '''lower newer'''
     return input_text, output_text
    def 						UpperCamelCase_				(  self   )       ->					List[str]:
     SCREAMING_SNAKE_CASE__:   Dict=      CLIPTokenizer(self.vocab_file , self.merges_file , **self.special_tokens_map   )
     SCREAMING_SNAKE_CASE__:   Tuple=      '''lower newer'''
     SCREAMING_SNAKE_CASE__:   Optional[int]=      ['''lo''', '''w''', '''er</w>''', '''n''', '''e''', '''w''', '''er</w>''']
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      tokenizer.tokenize(lowerCAmelCase   )
     self.assertListEqual(lowerCAmelCase , lowerCAmelCase   )

     SCREAMING_SNAKE_CASE__:   List[Any]=      tokens + [tokenizer.unk_token]
     SCREAMING_SNAKE_CASE__:   Any=      [10, 2, 16, 9, 3, 2, 16, 20]
     self.assertListEqual(tokenizer.convert_tokens_to_ids(lowerCAmelCase   ) , lowerCAmelCase   )
    @require_ftfy
    def 						UpperCamelCase_				(  self   )       ->					List[str]:
     for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
      with self.subTest(f'{tokenizer.__class__.__name__} ({pretrained_name})'   ):
       SCREAMING_SNAKE_CASE__:   List[str]=      self.tokenizer_class.from_pretrained(lowerCAmelCase , **lowerCAmelCase   )
       SCREAMING_SNAKE_CASE__:   Optional[Any]=      self.rust_tokenizer_class.from_pretrained(lowerCAmelCase , **lowerCAmelCase   )

       SCREAMING_SNAKE_CASE__:   Any=      '''A\n\'ll 11p223RF☆ho!!to?\'d\'d\'\'d of a cat to-$\'\'d.'''
       SCREAMING_SNAKE_CASE__:   Optional[Any]=      tokenizer_s.tokenize(lowerCAmelCase   )
       SCREAMING_SNAKE_CASE__:   Any=      tokenizer_r.tokenize(lowerCAmelCase   )

       self.assertListEqual(lowerCAmelCase , lowerCAmelCase   )

       # Test that the tokenization is identical on an example containing a character (Latin Small Letter A
       # with Tilde) encoded in 2 different ways
       SCREAMING_SNAKE_CASE__:   Union[str, Any]=      '''xa\u0303y''' + ''' ''' + '''x\xe3y'''
       SCREAMING_SNAKE_CASE__:   List[Any]=      tokenizer_s.tokenize(lowerCAmelCase   )
       SCREAMING_SNAKE_CASE__:   Dict=      tokenizer_r.tokenize(lowerCAmelCase   )

       self.assertListEqual(lowerCAmelCase , lowerCAmelCase   )

       # Test that the tokenization is identical on unicode of space type
       SCREAMING_SNAKE_CASE__:   Union[str, Any]=      [
           '''\u0009''',  # (horizontal tab, '\t')
           '''\u000B''',  # (vertical tab)
           '''\u000C''',  # (form feed)
           '''\u0020''',  # (space, ' ')
           '''\u200E''',  # (left-to-right mark):w
           '''\u200F''',  # (right-to-left mark)
       ]
       for unicode_seq in spaces_unicodes:
        SCREAMING_SNAKE_CASE__:   int=      tokenizer_s.tokenize(lowerCAmelCase   )
        SCREAMING_SNAKE_CASE__:   Optional[Any]=      tokenizer_r.tokenize(lowerCAmelCase   )

        self.assertListEqual(lowerCAmelCase , lowerCAmelCase   )

       # Test that the tokenization is identical on unicode of line break type
       SCREAMING_SNAKE_CASE__:   Any=      [
           '''\u000A''',  # (line feed, '\n')
           '''\r\n''',  # (carriage return and line feed, '\r\n')
           '''\u000D''',  # (carriage return, '\r')
           '''\r''',  # (carriage return, '\r')
           '''\u000D''',  # (carriage return, '\r')
           '''\u2028''',  # (line separator)
           '''\u2029''',  # (paragraph separator)
           # "\u0085", # (next line)
       ]

       # The tokenization is not identical for the character "\u0085" (next line). The slow version using ftfy transforms
       # it into the Horizontal Ellipsis character "…" ("\u2026") while the fast version transforms it into a
       # space (and thus into an empty list).

       for unicode_seq in line_break_unicodes:
        SCREAMING_SNAKE_CASE__:   Tuple=      tokenizer_s.tokenize(lowerCAmelCase   )
        SCREAMING_SNAKE_CASE__:   Optional[Any]=      tokenizer_r.tokenize(lowerCAmelCase   )

        self.assertListEqual(lowerCAmelCase , lowerCAmelCase   )
    def 						UpperCamelCase_				(  self   )       ->					Optional[int]:
     # Test which aims to verify that the offsets are well adapted to the argument `add_prefix_space`
     for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
      with self.subTest(f'{tokenizer.__class__.__name__} ({pretrained_name})'   ):
       SCREAMING_SNAKE_CASE__:   Optional[int]=      '''hello'''  # `hello` is a token in the vocabulary of `pretrained_name`
       SCREAMING_SNAKE_CASE__:   str=      f'{text_of_1_token} {text_of_1_token}'

       SCREAMING_SNAKE_CASE__:   Dict=      self.rust_tokenizer_class.from_pretrained(
           lowerCAmelCase , use_fast=lowerCAmelCase , )
       SCREAMING_SNAKE_CASE__:   List[Any]=      tokenizer_r(lowerCAmelCase , return_offsets_mapping=lowerCAmelCase , add_special_tokens=lowerCAmelCase   )
       self.assertEqual(encoding.offset_mapping[0] , (0, len(lowerCAmelCase   ))   )
       self.assertEqual(
           encoding.offset_mapping[1] , (len(lowerCAmelCase   ) + 1, len(lowerCAmelCase   ) + 1 + len(lowerCAmelCase   )) , )

       SCREAMING_SNAKE_CASE__:   int=      f' {text}'

       SCREAMING_SNAKE_CASE__:   List[str]=      self.rust_tokenizer_class.from_pretrained(
           lowerCAmelCase , use_fast=lowerCAmelCase , )
       SCREAMING_SNAKE_CASE__:   Optional[Any]=      tokenizer_r(lowerCAmelCase , return_offsets_mapping=lowerCAmelCase , add_special_tokens=lowerCAmelCase   )
       self.assertEqual(encoding.offset_mapping[0] , (1, 1 + len(lowerCAmelCase   ))   )
       self.assertEqual(
           encoding.offset_mapping[1] , (1 + len(lowerCAmelCase   ) + 1, 1 + len(lowerCAmelCase   ) + 1 + len(lowerCAmelCase   )) , )
    def 						UpperCamelCase_				(  self   )       ->					str:
     # Test related to the breaking change introduced in transformers v4.17.0
     # We need to check that an error in raised when the user try to load a previous version of the tokenizer.
     with self.assertRaises(lowerCAmelCase   ) as context:
      self.rust_tokenizer_class.from_pretrained('''robot-test/old-clip-tokenizer'''   )

     self.assertTrue(
         context.exception.args[0].startswith(
             '''The `backend_tokenizer` provided does not match the expected format.'''   )   )
    @require_ftfy
    def 						UpperCamelCase_				(  self   )       ->					Tuple:
     super().test_tokenization_python_rust_equals()



    def 						UpperCamelCase_				(  self   )       ->					Union[str, Any]:
     # CLIP always lower cases letters
     pass


from typing import Optional, Tuple, Union

import flax
import flax.linen as nn
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import FrozenDict

from ..configuration_utils import ConfigMixin, flax_register_to_config
from ..utils import BaseOutput
from .embeddings_flax import FlaxTimestepEmbedding, FlaxTimesteps
from .modeling_flax_utils import FlaxModelMixin
from .unet_ad_blocks_flax import (
    FlaxCrossAttnDownBlockaD,
    FlaxDownBlockaD,
    FlaxUNetMidBlockaDCrossAttn,
)






@flax.struct.dataclass
class 		_lowerCamelCase		(   UpperCamelCase_    ):
    __a  =      42
    __a  =      42






class 		_lowerCamelCase		(   nn.Module    ):
    __a  =      42
    __a  =      (16, 32, 96, 256)
    __a  =      jnp.floataa
    def 						UpperCamelCase_				(  self   )       ->					Optional[int]:
     SCREAMING_SNAKE_CASE__:   List[str]=      nn.Conv(
         self.block_out_channels[0] , kernel_size=(3, 3) , padding=((1, 1), (1, 1)) , dtype=self.dtype , )

     SCREAMING_SNAKE_CASE__:   Optional[int]=      []
     for i in range(len(self.block_out_channels   ) - 1   ):
      SCREAMING_SNAKE_CASE__:   str=      self.block_out_channels[i]
      SCREAMING_SNAKE_CASE__:   List[str]=      self.block_out_channels[i + 1]
      SCREAMING_SNAKE_CASE__:   List[Any]=      nn.Conv(
          lowerCAmelCase , kernel_size=(3, 3) , padding=((1, 1), (1, 1)) , dtype=self.dtype , )
      blocks.append(lowerCAmelCase   )
      SCREAMING_SNAKE_CASE__:   str=      nn.Conv(
          lowerCAmelCase , kernel_size=(3, 3) , strides=(2, 2) , padding=((1, 1), (1, 1)) , dtype=self.dtype , )
      blocks.append(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   str=      blocks

     SCREAMING_SNAKE_CASE__:   Optional[Any]=      nn.Conv(
         self.conditioning_embedding_channels , kernel_size=(3, 3) , padding=((1, 1), (1, 1)) , kernel_init=nn.initializers.zeros_init() , bias_init=nn.initializers.zeros_init() , dtype=self.dtype , )



    def __call__(  self , lowerCAmelCase   )       ->					Optional[Any]:
     SCREAMING_SNAKE_CASE__:   Dict=      self.conv_in(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Optional[int]=      nn.silu(lowerCAmelCase   )

     for block in self.blocks:
      SCREAMING_SNAKE_CASE__:   Optional[int]=      block(lowerCAmelCase   )
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      nn.silu(lowerCAmelCase   )

     SCREAMING_SNAKE_CASE__:   Any=      self.conv_out(lowerCAmelCase   )

     return embedding






@flax_register_to_config
class 		_lowerCamelCase		(   nn.Module    ,     UpperCamelCase_    ,     UpperCamelCase_    ):
    __a  =      32
    __a  =      4
    __a  =      (
        "CrossAttnDownBlock2D",
        "CrossAttnDownBlock2D",
        "CrossAttnDownBlock2D",
        "DownBlock2D",
    )
    __a  =      False
    __a  =      (320, 640, 1280, 1280)
    __a  =      2
    __a  =      8
    __a  =      None
    __a  =      1280
    __a  =      0.0
    __a  =      False
    __a  =      jnp.floataa
    __a  =      True
    __a  =      0
    __a  =      "rgb"
    __a  =      (16, 32, 96, 256)
    def 						UpperCamelCase_				(  self , lowerCAmelCase   )       ->					FrozenDict:
     # init input tensors
     SCREAMING_SNAKE_CASE__:   Any=      (1, self.in_channels, self.sample_size, self.sample_size)
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      jnp.zeros(lowerCAmelCase , dtype=jnp.floataa   )
     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      jnp.ones((1,) , dtype=jnp.intaa   )
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      jnp.zeros((1, 1, self.cross_attention_dim) , dtype=jnp.floataa   )
     SCREAMING_SNAKE_CASE__:   int=      (1, 3, self.sample_size * 8, self.sample_size * 8)
     SCREAMING_SNAKE_CASE__:   Optional[int]=      jnp.zeros(lowerCAmelCase , dtype=jnp.floataa   )

     SCREAMING_SNAKE_CASE__,	SCREAMING_SNAKE_CASE__:   Any=      jax.random.split(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Optional[int]=      {'''params''': params_rng, '''dropout''': dropout_rng}

     return self.init(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase   )["params"]
    def 						UpperCamelCase_				(  self   )       ->					Optional[Any]:
     SCREAMING_SNAKE_CASE__:   Dict=      self.block_out_channels
     SCREAMING_SNAKE_CASE__:   str=      block_out_channels[0] * 4

     # If `num_attention_heads` is not defined (which is the case for most models)
     # it will default to `attention_head_dim`. This looks weird upon first reading it and it is.
     # The reason for this behavior is to correct for incorrectly named variables that were introduced
     # when this library was created. The incorrect naming was only discovered much later in https://github.com/huggingface/diffusers/issues/2011#issuecomment-1547958131
     # Changing `attention_head_dim` to `num_attention_heads` for 40,000+ configurations is too backwards breaking
     # which is why we correct for the naming here.
     SCREAMING_SNAKE_CASE__:   int=      self.num_attention_heads or self.attention_head_dim

     # input
     SCREAMING_SNAKE_CASE__:   Any=      nn.Conv(
         block_out_channels[0] , kernel_size=(3, 3) , strides=(1, 1) , padding=((1, 1), (1, 1)) , dtype=self.dtype , )

     # time
     SCREAMING_SNAKE_CASE__:   str=      FlaxTimesteps(
         block_out_channels[0] , flip_sin_to_cos=self.flip_sin_to_cos , freq_shift=self.config.freq_shift   )
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      FlaxTimestepEmbedding(lowerCAmelCase , dtype=self.dtype   )

     SCREAMING_SNAKE_CASE__:   str=      FlaxControlNetConditioningEmbedding(
         conditioning_embedding_channels=block_out_channels[0] , block_out_channels=self.conditioning_embedding_out_channels , )

     SCREAMING_SNAKE_CASE__:   List[str]=      self.only_cross_attention
     if isinstance(lowerCAmelCase , lowerCAmelCase   ):
      SCREAMING_SNAKE_CASE__:   str=      (only_cross_attention,) * len(self.down_block_types   )

     if isinstance(lowerCAmelCase , lowerCAmelCase   ):
      SCREAMING_SNAKE_CASE__:   Dict=      (num_attention_heads,) * len(self.down_block_types   )

     # down
     SCREAMING_SNAKE_CASE__:   Optional[int]=      []
     SCREAMING_SNAKE_CASE__:   List[str]=      []

     SCREAMING_SNAKE_CASE__:   Union[str, Any]=      block_out_channels[0]

     SCREAMING_SNAKE_CASE__:   Dict=      nn.Conv(
         lowerCAmelCase , kernel_size=(1, 1) , padding='''VALID''' , kernel_init=nn.initializers.zeros_init() , bias_init=nn.initializers.zeros_init() , dtype=self.dtype , )
     controlnet_down_blocks.append(lowerCAmelCase   )

     for i, down_block_type in enumerate(self.down_block_types   ):
      SCREAMING_SNAKE_CASE__:   Tuple=      output_channel
      SCREAMING_SNAKE_CASE__:   Any=      block_out_channels[i]
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      i == len(lowerCAmelCase   ) - 1

      if down_block_type == "CrossAttnDownBlock2D":
       SCREAMING_SNAKE_CASE__:   Any=      FlaxCrossAttnDownBlockaD(
           in_channels=lowerCAmelCase , out_channels=lowerCAmelCase , dropout=self.dropout , num_layers=self.layers_per_block , num_attention_heads=num_attention_heads[i] , add_downsample=not is_final_block , use_linear_projection=self.use_linear_projection , only_cross_attention=only_cross_attention[i] , dtype=self.dtype , )
      else:
       SCREAMING_SNAKE_CASE__:   Union[str, Any]=      FlaxDownBlockaD(
           in_channels=lowerCAmelCase , out_channels=lowerCAmelCase , dropout=self.dropout , num_layers=self.layers_per_block , add_downsample=not is_final_block , dtype=self.dtype , )

      down_blocks.append(lowerCAmelCase   )

      for _ in range(self.layers_per_block   ):
       SCREAMING_SNAKE_CASE__:   str=      nn.Conv(
           lowerCAmelCase , kernel_size=(1, 1) , padding='''VALID''' , kernel_init=nn.initializers.zeros_init() , bias_init=nn.initializers.zeros_init() , dtype=self.dtype , )
       controlnet_down_blocks.append(lowerCAmelCase   )

      if not is_final_block:
       SCREAMING_SNAKE_CASE__:   str=      nn.Conv(
           lowerCAmelCase , kernel_size=(1, 1) , padding='''VALID''' , kernel_init=nn.initializers.zeros_init() , bias_init=nn.initializers.zeros_init() , dtype=self.dtype , )
       controlnet_down_blocks.append(lowerCAmelCase   )

     SCREAMING_SNAKE_CASE__:   int=      down_blocks
     SCREAMING_SNAKE_CASE__:   int=      controlnet_down_blocks

     # mid
     SCREAMING_SNAKE_CASE__:   Optional[int]=      block_out_channels[-1]
     SCREAMING_SNAKE_CASE__:   int=      FlaxUNetMidBlockaDCrossAttn(
         in_channels=lowerCAmelCase , dropout=self.dropout , num_attention_heads=num_attention_heads[-1] , use_linear_projection=self.use_linear_projection , dtype=self.dtype , )

     SCREAMING_SNAKE_CASE__:   str=      nn.Conv(
         lowerCAmelCase , kernel_size=(1, 1) , padding='''VALID''' , kernel_init=nn.initializers.zeros_init() , bias_init=nn.initializers.zeros_init() , dtype=self.dtype , )



    def __call__(  self , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase = 1.0 , lowerCAmelCase = True , lowerCAmelCase = False , )       ->					Union[FlaxControlNetOutput, Tuple]:
     SCREAMING_SNAKE_CASE__:   Dict=      self.controlnet_conditioning_channel_order
     if channel_order == "bgr":
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      jnp.flip(lowerCAmelCase , axis=1   )

     # 1. time
     if not isinstance(lowerCAmelCase , jnp.ndarray   ):
      SCREAMING_SNAKE_CASE__:   Optional[Any]=      jnp.array([timesteps] , dtype=jnp.intaa   )
     elif isinstance(lowerCAmelCase , jnp.ndarray   ) and len(timesteps.shape   ) == 0:
      SCREAMING_SNAKE_CASE__:   int=      timesteps.astype(dtype=jnp.floataa   )
      SCREAMING_SNAKE_CASE__:   Any=      jnp.expand_dims(lowerCAmelCase , 0   )

     SCREAMING_SNAKE_CASE__:   Dict=      self.time_proj(lowerCAmelCase   )
     SCREAMING_SNAKE_CASE__:   Dict=      self.time_embedding(lowerCAmelCase   )

     # 2. pre-process
     SCREAMING_SNAKE_CASE__:   int=      jnp.transpose(lowerCAmelCase , (0, 2, 3, 1)   )
     SCREAMING_SNAKE_CASE__:   str=      self.conv_in(lowerCAmelCase   )

     SCREAMING_SNAKE_CASE__:   Optional[Any]=      jnp.transpose(lowerCAmelCase , (0, 2, 3, 1)   )
     SCREAMING_SNAKE_CASE__:   str=      self.controlnet_cond_embedding(lowerCAmelCase   )
     sample += controlnet_cond

     # 3. down
     SCREAMING_SNAKE_CASE__:   Tuple=      (sample,)
     for down_block in self.down_blocks:
      if isinstance(lowerCAmelCase , lowerCAmelCase   ):
       SCREAMING_SNAKE_CASE__,	SCREAMING_SNAKE_CASE__:   Tuple=      down_block(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , deterministic=not train   )
      else:
       SCREAMING_SNAKE_CASE__,	SCREAMING_SNAKE_CASE__:   int=      down_block(lowerCAmelCase , lowerCAmelCase , deterministic=not train   )
      down_block_res_samples += res_samples

     # 4. mid
     SCREAMING_SNAKE_CASE__:   Optional[Any]=      self.mid_block(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , deterministic=not train   )

     # 5. contronet blocks
     SCREAMING_SNAKE_CASE__:   Optional[int]=      ()
     for down_block_res_sample, controlnet_block in zip(lowerCAmelCase , self.controlnet_down_blocks   ):
      SCREAMING_SNAKE_CASE__:   List[str]=      controlnet_block(lowerCAmelCase   )
      controlnet_down_block_res_samples += (down_block_res_sample,)

     SCREAMING_SNAKE_CASE__:   Optional[Any]=      controlnet_down_block_res_samples

     SCREAMING_SNAKE_CASE__:   Optional[int]=      self.controlnet_mid_block(lowerCAmelCase   )

     # 6. scaling
     SCREAMING_SNAKE_CASE__:   Tuple=      [sample * conditioning_scale for sample in down_block_res_samples]
     mid_block_res_sample *= conditioning_scale

     if not return_dict:
      return (down_block_res_samples, mid_block_res_sample)

     return FlaxControlNetOutput(
         down_block_res_samples=lowerCAmelCase , mid_block_res_sample=lowerCAmelCase   )

