

'''simple docstring'''



from typing import List, Optional, Union

import torch
from transformers import (
    XLMRobertaTokenizer,
)

from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDIMScheduler, DDPMScheduler
from ...utils import (
    is_accelerate_available,
    is_accelerate_version,
    logging,
    randn_tensor,
    replace_example_docstring,
)
from .text_encoder import MultilingualCLIP


__UpperCamelCase      :       Dict      			=      logging.get_logger(__name__)  # pylint: disable=invalid-name

__UpperCamelCase      :       Optional[int]      			=      """
    Examples:
        ```py
        >>> from diffusers import KandinskyPipeline, KandinskyPriorPipeline
        >>> import torch

        >>> pipe_prior = KandinskyPriorPipeline.from_pretrained(\"kandinsky-community/Kandinsky-2-1-prior\")
        >>> pipe_prior.to(\"cuda\")

        >>> prompt = \"red cat, 4k photo\"
        >>> out = pipe_prior(prompt)
        >>> image_emb = out.image_embeds
        >>> negative_image_emb = out.negative_image_embeds

        >>> pipe = KandinskyPipeline.from_pretrained(\"kandinsky-community/kandinsky-2-1\")
        >>> pipe.to(\"cuda\")

        >>> image = pipe(
        ...     prompt,
        ...     image_embeds=image_emb,
        ...     negative_image_embeds=negative_image_emb,
        ...     height=768,
        ...     width=768,
        ...     num_inference_steps=100,
        ... ).images

        >>> image[0].save(\"cat.png\")
        ```
"""



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	List[Any],					SCREAMING_SNAKE_CASE__:	Optional[Any],					SCREAMING_SNAKE_CASE__:	List[Any]=8    )  ->			List[str]:

   """simple docstring"""
   __a				     =    h // scale_factor**2
   if h % scale_factor**2 != 0:
      new_h += 1
   __a				     =    w // scale_factor**2
   if w % scale_factor**2 != 0:
      new_w += 1
   return new_h * scale_factor, new_w * scale_factor



class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):




      def __init__(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   )							->Dict:



         '''simple docstring'''
         super().__init__()

         self.register_modules(
             text_encoder=lowerCamelCase ,   tokenizer=lowerCamelCase ,   unet=lowerCamelCase ,   scheduler=lowerCamelCase ,   movq=lowerCamelCase ,   )
         __a				     =    2 ** (len(self.movq.config.block_out_channels      ) - 1)




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase      )							->str:



         '''simple docstring'''
         if latents is None:
            __a				     =    randn_tensor(lowerCamelCase ,   generator=lowerCamelCase ,   device=lowerCamelCase ,   dtype=lowerCamelCase      )
         else:
            if latents.shape != shape:
               raise ValueError(F"""Unexpected latents shape, got {latents.shape}, expected {shape}"""      )
            __a				     =    latents.to(lowerCamelCase      )

         __a				     =    latents * scheduler.init_noise_sigma
         return latents




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase=None ,   )							->List[str]:



         '''simple docstring'''
         __a				     =    len(lowerCamelCase      ) if isinstance(lowerCamelCase ,   lowerCamelCase      ) else 1
         # get prompt text embeddings
         __a				     =    self.tokenizer(
             lowerCamelCase ,   padding='max_length' ,   truncation=lowerCamelCase ,   max_length=77 ,   return_attention_mask=lowerCamelCase ,   add_special_tokens=lowerCamelCase ,   return_tensors='pt' ,   )

         __a				     =    text_inputs.input_ids
         __a				     =    self.tokenizer(lowerCamelCase ,   padding='longest' ,   return_tensors='pt'      ).input_ids

         if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(lowerCamelCase ,   lowerCamelCase      ):
            __a				     =    self.tokenizer.batch_decode(untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1]      )
            logger.warning(
                'The following part of your input was truncated because CLIP can only handle sequences up to'
                F""" {self.tokenizer.model_max_length} tokens: {removed_text}"""      )

         __a				     =    text_input_ids.to(lowerCamelCase      )
         __a				     =    text_inputs.attention_mask.to(lowerCamelCase      )

         __a     ,			__a				     =    self.text_encoder(
             input_ids=lowerCamelCase ,   attention_mask=lowerCamelCase      )

         __a				     =    prompt_embeds.repeat_interleave(lowerCamelCase ,   dim=0      )
         __a				     =    text_encoder_hidden_states.repeat_interleave(lowerCamelCase ,   dim=0      )
         __a				     =    text_mask.repeat_interleave(lowerCamelCase ,   dim=0      )

         if do_classifier_free_guidance:
            __a				     =    42
            if negative_prompt is None:
               __a				     =    [''] * batch_size
            elif type(lowerCamelCase      ) is not type(lowerCamelCase      ):
               raise TypeError(
                   F"""`negative_prompt` should be the same type to `prompt`, but got {type(lowerCamelCase      )} !="""
                   F""" {type(lowerCamelCase      )}."""      )
            elif isinstance(lowerCamelCase ,   lowerCamelCase      ):
               __a				     =    [negative_prompt]
            elif batch_size != len(lowerCamelCase      ):
               raise ValueError(
                   F"""`negative_prompt`: {negative_prompt} has batch size {len(lowerCamelCase      )}, but `prompt`:"""
                   F""" {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches"""
                   ' the batch size of `prompt`.'      )
            else:
               __a				     =    negative_prompt

            __a				     =    self.tokenizer(
                lowerCamelCase ,   padding='max_length' ,   max_length=77 ,   truncation=lowerCamelCase ,   return_attention_mask=lowerCamelCase ,   add_special_tokens=lowerCamelCase ,   return_tensors='pt' ,   )
            __a				     =    uncond_input.input_ids.to(lowerCamelCase      )
            __a				     =    uncond_input.attention_mask.to(lowerCamelCase      )

            __a     ,			__a				     =    self.text_encoder(
                input_ids=lowerCamelCase ,   attention_mask=lowerCamelCase      )

            # duplicate unconditional embeddings for each generation per prompt, using mps friendly method

            __a				     =    negative_prompt_embeds.shape[1]
            __a				     =    negative_prompt_embeds.repeat(1 ,   lowerCamelCase      )
            __a				     =    negative_prompt_embeds.view(batch_size * num_images_per_prompt ,   lowerCamelCase      )

            __a				     =    uncond_text_encoder_hidden_states.shape[1]
            __a				     =    uncond_text_encoder_hidden_states.repeat(1 ,   lowerCamelCase ,   1      )
            __a				     =    uncond_text_encoder_hidden_states.view(
                batch_size * num_images_per_prompt ,   lowerCamelCase ,   -1      )
            __a				     =    uncond_text_mask.repeat_interleave(lowerCamelCase ,   dim=0      )

            # done duplicates

            # For classifier free guidance, we need to do two forward passes.
            # Here we concatenate the unconditional and text embeddings into a single batch
            # to avoid doing two forward passes
            __a				     =    torch.cat([negative_prompt_embeds, prompt_embeds]      )
            __a				     =    torch.cat([uncond_text_encoder_hidden_states, text_encoder_hidden_states]      )

            __a				     =    torch.cat([uncond_text_mask, text_mask]      )

         return prompt_embeds, text_encoder_hidden_states, text_mask




      def  __UpperCamelCase							(  self ,   lowerCamelCase=0      )							->Optional[int]:



         '''simple docstring'''
         if is_accelerate_available():
            from accelerate import cpu_offload
         else:
            raise ImportError('Please install accelerate via `pip install accelerate`'      )

         __a				     =    torch.device(F"""cuda:{gpu_id}"""      )

         __a				     =    [
             self.unet,
             self.text_encoder,
             self.movq,
         ]
         for cpu_offloaded_model in models:
            if cpu_offloaded_model is not None:
               cpu_offload(lowerCamelCase ,   lowerCamelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase=0      )							->Optional[int]:



         '''simple docstring'''
         if is_accelerate_available() and is_accelerate_version('>=' ,   '0.17.0.dev0'      ):
            from accelerate import cpu_offload_with_hook
         else:
            raise ImportError('`enable_model_cpu_offload` requires `accelerate v0.17.0` or higher.'      )

         __a				     =    torch.device(F"""cuda:{gpu_id}"""      )

         if self.device.type != "cpu":
            self.to('cpu' ,   silence_dtype_warnings=lowerCamelCase      )
            torch.cuda.empty_cache()  # otherwise we don't see the memory savings (but they probably exist)

         __a				     =    None
         for cpu_offloaded_model in [self.text_encoder, self.unet, self.movq]:
            __a     ,			__a				     =    cpu_offload_with_hook(lowerCamelCase ,   lowerCamelCase ,   prev_module_hook=lowerCamelCase      )

         if self.safety_checker is not None:
            __a     ,			__a				     =    cpu_offload_with_hook(self.safety_checker ,   lowerCamelCase ,   prev_module_hook=lowerCamelCase      )

         # We'll offload the last model manually.
         __a				     =    hook




      @property
      # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._execution_device
      def  __UpperCamelCase							(  self      )							->Optional[Any]:



         '''simple docstring'''
         if not hasattr(self.unet ,   '_hf_hook'      ):
            return self.device
         for module in self.unet.modules():
            if (
                hasattr(lowerCamelCase ,   '_hf_hook'      )
                and hasattr(module._hf_hook ,   'execution_device'      )
                and module._hf_hook.execution_device is not None
            ):
               return torch.device(module._hf_hook.execution_device      )
         return self.device






      @torch.no_grad()
      @replace_example_docstring(lowerCamelCase      )
      def __call__(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase = None ,   lowerCamelCase = 512 ,   lowerCamelCase = 512 ,   lowerCamelCase = 100 ,   lowerCamelCase = 4.0 ,   lowerCamelCase = 1 ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = "pil" ,   lowerCamelCase = True ,   )							->Optional[Any]:



         '''simple docstring'''

         if isinstance(lowerCamelCase ,   lowerCamelCase      ):
            __a				     =    1
         elif isinstance(lowerCamelCase ,   lowerCamelCase      ):
            __a				     =    len(lowerCamelCase      )
         else:
            raise ValueError(F"""`prompt` has to be of type `str` or `list` but is {type(lowerCamelCase      )}"""      )

         __a				     =    self._execution_device

         __a				     =    batch_size * num_images_per_prompt
         __a				     =    guidance_scale > 1.0

         __a     ,			__a     ,			__a				     =    self._encode_prompt(
             lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase      )

         if isinstance(lowerCamelCase ,   lowerCamelCase      ):
            __a				     =    torch.cat(lowerCamelCase ,   dim=0      )
         if isinstance(lowerCamelCase ,   lowerCamelCase      ):
            __a				     =    torch.cat(lowerCamelCase ,   dim=0      )

         if do_classifier_free_guidance:
            __a				     =    image_embeds.repeat_interleave(lowerCamelCase ,   dim=0      )
            __a				     =    negative_image_embeds.repeat_interleave(lowerCamelCase ,   dim=0      )

         __a				     =    torch.cat([negative_image_embeds, image_embeds] ,   dim=0      ).to(
             dtype=prompt_embeds.dtype ,   device=lowerCamelCase      )

         self.scheduler.set_timesteps(lowerCamelCase ,   device=lowerCamelCase      )
         __a				     =    self.scheduler.timesteps

         __a				     =    self.unet.config.in_channels

         __a     ,			__a				     =    get_new_h_w(lowerCamelCase ,   lowerCamelCase ,   self.movq_scale_factor      )

         # create initial latent
         __a				     =    self.prepare_latents(
             (batch_size, num_channels_latents, height, width) ,   text_encoder_hidden_states.dtype ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   self.scheduler ,   )

         for i, t in enumerate(self.progress_bar(lowerCamelCase      )      ):
            # expand the latents if we are doing classifier free guidance
            __a				     =    torch.cat([latents] * 2      ) if do_classifier_free_guidance else latents

            __a				     =    {'text_embeds': prompt_embeds, 'image_embeds': image_embeds}
            __a				     =    self.unet(
                sample=lowerCamelCase ,   timestep=lowerCamelCase ,   encoder_hidden_states=lowerCamelCase ,   added_cond_kwargs=lowerCamelCase ,   return_dict=lowerCamelCase ,   )[0]

            if do_classifier_free_guidance:
               __a     ,			__a				     =    noise_pred.split(latents.shape[1] ,   dim=1      )
               __a     ,			__a				     =    noise_pred.chunk(2      )
               __a     ,			__a				     =    variance_pred.chunk(2      )
               __a				     =    noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
               __a				     =    torch.cat([noise_pred, variance_pred_text] ,   dim=1      )

            if not (
                hasattr(self.scheduler.config ,   'variance_type'      )
                and self.scheduler.config.variance_type in ["learned", "learned_range"]
            ):
               __a     ,			__a				     =    noise_pred.split(latents.shape[1] ,   dim=1      )

            # compute the previous noisy sample x_t -> x_t-1
            __a				     =    self.scheduler.step(
                lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   generator=lowerCamelCase ,   ).prev_sample
         # post-processing
         __a				     =    self.movq.decode(lowerCamelCase ,   force_not_quantize=lowerCamelCase      )['sample']

         if output_type not in ["pt", "np", "pil"]:
            raise ValueError(F"""Only the output types `pt`, `pil` and `np` are supported not output_type={output_type}"""      )

         if output_type in ["np", "pil"]:
            __a				     =    image * 0.5 + 0.5
            __a				     =    image.clamp(0 ,   1      )
            __a				     =    image.cpu().permute(0 ,   2 ,   3 ,   1      ).float().numpy()

         if output_type == "pil":
            __a				     =    self.numpy_to_pil(lowerCamelCase      )

         if not return_dict:
            return (image,)

         return ImagePipelineOutput(images=lowerCamelCase      )







'''simple docstring'''



from typing import Dict, List, Optional, Union

import numpy as np

from transformers.utils import is_vision_available
from transformers.utils.generic import TensorType

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    is_valid_image,
    to_numpy_array,
    valid_images,
)
from ...utils import logging


if is_vision_available():
 import PIL

__UpperCamelCase      :       Dict      			=      logging.get_logger(__name__)



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	str    )  ->			List[List[ImageInput]]:

   """simple docstring"""
   if isinstance(SCREAMING_SNAKE_CASE__,					(list, tuple)    ) and isinstance(videos[0],					(list, tuple)    ) and is_valid_image(videos[0][0]    ):
      return videos

   elif isinstance(SCREAMING_SNAKE_CASE__,					(list, tuple)    ) and is_valid_image(videos[0]    ):
      return [videos]

   elif is_valid_image(SCREAMING_SNAKE_CASE__    ):
      return [[videos]]

   raise ValueError(f"""Could not make batched video from {videos}"""    )



class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):
      __a  					=["pixel_values"]




      def __init__(  self ,   lowerCamelCase = True ,   lowerCamelCase = None ,   lowerCamelCase = PILImageResampling.BILINEAR ,   lowerCamelCase = True ,   lowerCamelCase = None ,   lowerCamelCase = True ,   lowerCamelCase = 1 / 255 ,   lowerCamelCase = True ,   lowerCamelCase = True ,   lowerCamelCase = None ,   lowerCamelCase = None ,   **lowerCamelCase ,   )							->None:



         '''simple docstring'''
         super().__init__(**lowerCamelCase      )
         __a				     =    size if size is not None else {'shortest_edge': 256}
         __a				     =    get_size_dict(lowerCamelCase ,   default_to_square=lowerCamelCase      )
         __a				     =    crop_size if crop_size is not None else {'height': 224, 'width': 224}
         __a				     =    get_size_dict(lowerCamelCase ,   param_name='crop_size'      )

         __a				     =    do_resize
         __a				     =    size
         __a				     =    do_center_crop
         __a				     =    crop_size
         __a				     =    resample
         __a				     =    do_rescale
         __a				     =    rescale_factor
         __a				     =    offset
         __a				     =    do_normalize
         __a				     =    image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
         __a				     =    image_std if image_std is not None else IMAGENET_STANDARD_STD




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase = PILImageResampling.BILINEAR ,   lowerCamelCase = None ,   **lowerCamelCase ,   )							->np.ndarray:



         '''simple docstring'''
         __a				     =    get_size_dict(lowerCamelCase ,   default_to_square=lowerCamelCase      )
         if "shortest_edge" in size:
            __a				     =    get_resize_output_image_size(lowerCamelCase ,   size['shortest_edge'] ,   default_to_square=lowerCamelCase      )
         elif "height" in size and "width" in size:
            __a				     =    (size['height'], size['width'])
         else:
            raise ValueError(F"""Size must have 'height' and 'width' or 'shortest_edge' as keys. Got {size.keys()}"""      )
         return resize(lowerCamelCase ,   size=lowerCamelCase ,   resample=lowerCamelCase ,   data_format=lowerCamelCase ,   **lowerCamelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase = None ,   **lowerCamelCase ,   )							->np.ndarray:



         '''simple docstring'''
         __a				     =    get_size_dict(lowerCamelCase      )
         if "height" not in size or "width" not in size:
            raise ValueError(F"""Size must have 'height' and 'width' as keys. Got {size.keys()}"""      )
         return center_crop(lowerCamelCase ,   size=(size['height'], size['width']) ,   data_format=lowerCamelCase ,   **lowerCamelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase = True ,   lowerCamelCase = None ,   **lowerCamelCase ,   )							->Optional[Any]:



         '''simple docstring'''
         __a				     =    image.astype(np.floataa      )
         if offset:
            __a				     =    image - (scale / 2)
         return rescale(lowerCamelCase ,   scale=lowerCamelCase ,   data_format=lowerCamelCase ,   **lowerCamelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase = None ,   **lowerCamelCase ,   )							->np.ndarray:



         '''simple docstring'''
         return normalize(lowerCamelCase ,   mean=lowerCamelCase ,   std=lowerCamelCase ,   data_format=lowerCamelCase ,   **lowerCamelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = ChannelDimension.FIRST ,   )							->np.ndarray:



         '''simple docstring'''
         if do_resize and size is None or resample is None:
            raise ValueError('Size and resample must be specified if do_resize is True.'      )

         if do_center_crop and crop_size is None:
            raise ValueError('Crop size must be specified if do_center_crop is True.'      )

         if do_rescale and rescale_factor is None:
            raise ValueError('Rescale factor must be specified if do_rescale is True.'      )

         if do_normalize and (image_mean is None or image_std is None):
            raise ValueError('Image mean and std must be specified if do_normalize is True.'      )

         if offset and not do_rescale:
            raise ValueError('For offset, do_rescale must also be set to True.'      )

         # All transformations expect numpy arrays.
         __a				     =    to_numpy_array(lowerCamelCase      )

         if do_resize:
            __a				     =    self.resize(image=lowerCamelCase ,   size=lowerCamelCase ,   resample=lowerCamelCase      )

         if do_center_crop:
            __a				     =    self.center_crop(lowerCamelCase ,   size=lowerCamelCase      )

         if do_rescale:
            __a				     =    self.rescale(image=lowerCamelCase ,   scale=lowerCamelCase ,   offset=lowerCamelCase      )

         if do_normalize:
            __a				     =    self.normalize(image=lowerCamelCase ,   mean=lowerCamelCase ,   std=lowerCamelCase      )

         __a				     =    to_channel_dimension_format(lowerCamelCase ,   lowerCamelCase      )
         return image






      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = None ,   lowerCamelCase = ChannelDimension.FIRST ,   **lowerCamelCase ,   )							->PIL.Image.Image:



         '''simple docstring'''
         __a				     =    do_resize if do_resize is not None else self.do_resize
         __a				     =    resample if resample is not None else self.resample
         __a				     =    do_center_crop if do_center_crop is not None else self.do_center_crop
         __a				     =    do_rescale if do_rescale is not None else self.do_rescale
         __a				     =    rescale_factor if rescale_factor is not None else self.rescale_factor
         __a				     =    offset if offset is not None else self.offset
         __a				     =    do_normalize if do_normalize is not None else self.do_normalize
         __a				     =    image_mean if image_mean is not None else self.image_mean
         __a				     =    image_std if image_std is not None else self.image_std

         __a				     =    size if size is not None else self.size
         __a				     =    get_size_dict(lowerCamelCase ,   default_to_square=lowerCamelCase      )
         __a				     =    crop_size if crop_size is not None else self.crop_size
         __a				     =    get_size_dict(lowerCamelCase ,   param_name='crop_size'      )

         if not valid_images(lowerCamelCase      ):
            raise ValueError(
                'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
                'torch.Tensor, tf.Tensor or jax.ndarray.'      )

         __a				     =    make_batched(lowerCamelCase      )

         __a				     =    [
             [
                 self._preprocess_image(
                     image=lowerCamelCase ,   do_resize=lowerCamelCase ,   size=lowerCamelCase ,   resample=lowerCamelCase ,   do_center_crop=lowerCamelCase ,   crop_size=lowerCamelCase ,   do_rescale=lowerCamelCase ,   rescale_factor=lowerCamelCase ,   offset=lowerCamelCase ,   do_normalize=lowerCamelCase ,   image_mean=lowerCamelCase ,   image_std=lowerCamelCase ,   data_format=lowerCamelCase ,   )
                 for img in video
             ]
             for video in videos
         ]

         __a				     =    {'pixel_values': videos}
         return BatchFeature(data=lowerCamelCase ,   tensor_type=lowerCamelCase      )