


"""simple docstring"""





from typing import List, Optional, Union

import numpy as np
import PIL
import torch
from PIL import Image

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


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

snake_case__		:     Any    				=				'''
    Examples:
        ```py
        >>> from diffusers import KandinskyV22Img2ImgPipeline, KandinskyV22PriorPipeline
        >>> from diffusers.utils import load_image
        >>> import torch

        >>> pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
        ...     "kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
        ... )
        >>> pipe_prior.to("cuda")

        >>> prompt = "A red cartoon frog, 4k"
        >>> image_emb, zero_image_emb = pipe_prior(prompt, return_dict=False)

        >>> pipe = KandinskyV22Img2ImgPipeline.from_pretrained(
        ...     "kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
        ... )
        >>> pipe.to("cuda")

        >>> init_image = load_image(
        ...     "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
        ...     "/kandinsky/frog.png"
        ... )

        >>> image = pipe(
        ...     image=init_image,
        ...     image_embeds=image_emb,
        ...     negative_image_embeds=zero_image_emb,
        ...     height=768,
        ...     width=768,
        ...     num_inference_steps=100,
        ...     strength=0.2,
        ... ).images

        >>> image[0].save("red_frog.png")
        ```
'''


def      _snake_case						(						_snake_case				:			Tuple ,   _snake_case				:			Union[str, Any] ,   _snake_case				:			List[Any]=8			):
      lowerCAmelCase					:	int       =   height // scale_factor**2
      if height % scale_factor**2 != 0:
            new_height += 1
      lowerCAmelCase					:	List[str]       =   width // scale_factor**2
      if width % scale_factor**2 != 0:
            new_width += 1
      return new_height * scale_factor, new_width * scale_factor


def      _snake_case						(						_snake_case				:			int ,   _snake_case				:			Optional[int]=512 ,   _snake_case				:			Tuple=512			):
      lowerCAmelCase					:	Tuple       =   pil_image.resize((w, h) ,   resample=Image.BICUBIC ,   reducing_gap=1			)
      lowerCAmelCase					:	Tuple       =   np.array(pil_image.convert('''RGB'''			)			)
      lowerCAmelCase					:	List[Any]       =   arr.astype(np.floataa			) / 127.5 - 1
      lowerCAmelCase					:	Any       =   np.transpose(_snake_case ,   [2, 0, 1]			)
      lowerCAmelCase					:	Any       =   torch.from_numpy(_snake_case			).unsqueeze(0			)
      return image






class 		snake_case_(       a__			):






     def __init__(	self  :					List[Any]					,				UpperCamelCase_  :					UNetaDConditionModel					,				UpperCamelCase_  :					DDPMScheduler					,				UpperCamelCase_  :					VQModel					,				):
           super().__init__()

           self.register_modules(
               unet=UpperCamelCase_					,				scheduler=UpperCamelCase_					,				movq=UpperCamelCase_					,				)
           lowerCAmelCase					:	str       =   2 ** (len(self.movq.config.block_out_channels				) - 1)






     def      lowerCamelCase__     (	self  :					str					,				UpperCamelCase_  :					Optional[int]					,				UpperCamelCase_  :					Optional[Any]					,				UpperCamelCase_  :					int				):
           # get the original timestep using init_timestep
           lowerCAmelCase					:	str       =   min(int(num_inference_steps * strength				)					,				UpperCamelCase_				)

           lowerCAmelCase					:	List[Any]       =   max(num_inference_steps - init_timestep					,				0				)
           lowerCAmelCase					:	Union[str, Any]       =   self.scheduler.timesteps[t_start:]

           return timesteps, num_inference_steps - t_start






     def      lowerCamelCase__     (	self  :					List[str]					,				UpperCamelCase_  :					Optional[Any]					,				UpperCamelCase_  :					List[Any]					,				UpperCamelCase_  :					Union[str, Any]					,				UpperCamelCase_  :					Union[str, Any]					,				UpperCamelCase_  :					int					,				UpperCamelCase_  :					List[Any]					,				UpperCamelCase_  :					Optional[Any]=None				):
           if not isinstance(UpperCamelCase_					,				(torch.Tensor, PIL.Image.Image, list)				):
                 raise ValueError(
                     F'''`image` has to be of type `torch.Tensor`, `PIL.Image.Image` or list but is {type(UpperCamelCase_				)}'''				)

           lowerCAmelCase					:	Any       =   image.to(device=UpperCamelCase_					,				dtype=UpperCamelCase_				)

           lowerCAmelCase					:	Optional[Any]       =   batch_size * num_images_per_prompt

           if image.shape[1] == 4:
                 lowerCAmelCase					:	Optional[int]       =   image

           else:
                 if isinstance(UpperCamelCase_					,				UpperCamelCase_				) and len(UpperCamelCase_				) != batch_size:
                       raise ValueError(
                           F'''You have passed a list of generators of length {len(UpperCamelCase_				)}, but requested an effective batch'''
                           F''' size of {batch_size}. Make sure the batch size matches the length of the generators.'''				)

                 elif isinstance(UpperCamelCase_					,				UpperCamelCase_				):
                       lowerCAmelCase					:	Tuple       =   [
                           self.movq.encode(image[i : i + 1]				).latent_dist.sample(generator[i]				) for i in range(UpperCamelCase_				)
                       ]
                       lowerCAmelCase					:	str       =   torch.cat(UpperCamelCase_					,				dim=0				)
                 else:
                       lowerCAmelCase					:	List[Any]       =   self.movq.encode(UpperCamelCase_				).latent_dist.sample(UpperCamelCase_				)

                 lowerCAmelCase					:	Tuple       =   self.movq.config.scaling_factor * init_latents

           lowerCAmelCase					:	Tuple       =   torch.cat([init_latents]					,				dim=0				)

           lowerCAmelCase					:	Union[str, Any]       =   init_latents.shape
           lowerCAmelCase					:	Tuple       =   randn_tensor(UpperCamelCase_					,				generator=UpperCamelCase_					,				device=UpperCamelCase_					,				dtype=UpperCamelCase_				)

           # get latents
           lowerCAmelCase					:	Tuple       =   self.scheduler.add_noise(UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_				)

           lowerCAmelCase					:	Any       =   init_latents

           return latents






     def      lowerCamelCase__     (	self  :					Dict					,				UpperCamelCase_  :					int=0				):
           if is_accelerate_available():
                 from accelerate import cpu_offload
           else:
                 raise ImportError('''Please install accelerate via `pip install accelerate`'''				)

           lowerCAmelCase					:	Tuple       =   torch.device(F'''cuda:{gpu_id}'''				)

           lowerCAmelCase					:	int       =   [
               self.unet,
               self.movq,
           ]
           for cpu_offloaded_model in models:
                 if cpu_offloaded_model is not None:
                       cpu_offload(UpperCamelCase_					,				UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					str					,				UpperCamelCase_  :					int=0				):
           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.'''				)

           lowerCAmelCase					:	Union[str, Any]       =   torch.device(F'''cuda:{gpu_id}'''				)

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

           lowerCAmelCase					:	Tuple       =   None
           for cpu_offloaded_model in [self.unet, self.movq]:
                 lowerCAmelCase,      lowerCAmelCase					:	Any       =   cpu_offload_with_hook(UpperCamelCase_					,				UpperCamelCase_					,				prev_module_hook=UpperCamelCase_				)

           # We'll offload the last model manually.
           lowerCAmelCase					:	Union[str, Any]       =   hook






     @property
     # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._execution_device
     def      lowerCamelCase__     (	self  :					Dict				):
           if not hasattr(self.unet					,				'''_hf_hook'''				):
                 return self.device
           for module in self.unet.modules():
                 if (
                     hasattr(UpperCamelCase_					,				'''_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(UpperCamelCase_				)
     def __call__(	self  :					Optional[Any]					,				UpperCamelCase_  :					Union[torch.FloatTensor, List[torch.FloatTensor]]					,				UpperCamelCase_  :					Union[torch.FloatTensor, PIL.Image.Image, List[torch.FloatTensor], List[PIL.Image.Image]]					,				UpperCamelCase_  :					Union[torch.FloatTensor, List[torch.FloatTensor]]					,				UpperCamelCase_  :					int = 5_1_2					,				UpperCamelCase_  :					int = 5_1_2					,				UpperCamelCase_  :					int = 1_0_0					,				UpperCamelCase_  :					float = 4.0					,				UpperCamelCase_  :					float = 0.3					,				UpperCamelCase_  :					int = 1					,				UpperCamelCase_  :					Optional[Union[torch.Generator, List[torch.Generator]]] = None					,				UpperCamelCase_  :					Optional[str] = "pil"					,				UpperCamelCase_  :					bool = True					,				):
           lowerCAmelCase					:	Tuple       =   self._execution_device

           lowerCAmelCase					:	str       =   guidance_scale > 1.0

           if isinstance(UpperCamelCase_					,				UpperCamelCase_				):
                 lowerCAmelCase					:	Dict       =   torch.cat(UpperCamelCase_					,				dim=0				)
           lowerCAmelCase					:	int       =   image_embeds.shape[0]
           if isinstance(UpperCamelCase_					,				UpperCamelCase_				):
                 lowerCAmelCase					:	str       =   torch.cat(UpperCamelCase_					,				dim=0				)

           if do_classifier_free_guidance:
                 lowerCAmelCase					:	int       =   image_embeds.repeat_interleave(UpperCamelCase_					,				dim=0				)
                 lowerCAmelCase					:	Optional[int]       =   negative_image_embeds.repeat_interleave(UpperCamelCase_					,				dim=0				)

           lowerCAmelCase					:	Optional[int]       =   torch.cat([negative_image_embeds, image_embeds]					,				dim=0				).to(dtype=self.unet.dtype					,				device=UpperCamelCase_				)

           if not isinstance(UpperCamelCase_					,				UpperCamelCase_				):
                 lowerCAmelCase					:	Optional[Any]       =   [image]
           if not all(isinstance(UpperCamelCase_					,				(PIL.Image.Image, torch.Tensor)				) for i in image				):
                 raise ValueError(
                     F'''Input is in incorrect format: {[type(UpperCamelCase_				) for i in image]}. Currently, we only support  PIL image and pytorch tensor'''				)

           lowerCAmelCase					:	List[str]       =   torch.cat([prepare_image(UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_				) for i in image]					,				dim=0				)
           lowerCAmelCase					:	Union[str, Any]       =   image.to(dtype=image_embeds.dtype					,				device=UpperCamelCase_				)

           lowerCAmelCase					:	str       =   self.movq.encode(UpperCamelCase_				)['''latents''']
           lowerCAmelCase					:	Optional[int]       =   latents.repeat_interleave(UpperCamelCase_					,				dim=0				)
           self.scheduler.set_timesteps(UpperCamelCase_					,				device=UpperCamelCase_				)
           lowerCAmelCase,      lowerCAmelCase					:	Union[str, Any]       =   self.get_timesteps(UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_				)
           lowerCAmelCase					:	int       =   timesteps[:1].repeat(batch_size * num_images_per_prompt				)
           lowerCAmelCase,      lowerCAmelCase					:	List[Any]       =   downscale_height_and_width(UpperCamelCase_					,				UpperCamelCase_					,				self.movq_scale_factor				)
           lowerCAmelCase					:	Dict       =   self.prepare_latents(
               UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_					,				image_embeds.dtype					,				UpperCamelCase_					,				UpperCamelCase_				)
           for i, t in enumerate(self.progress_bar(UpperCamelCase_				)				):
                 # expand the latents if we are doing classifier free guidance
                 lowerCAmelCase					:	Any       =   torch.cat([latents] * 2				) if do_classifier_free_guidance else latents

                 lowerCAmelCase					:	List[Any]       =   {'''image_embeds''': image_embeds}
                 lowerCAmelCase					:	Union[str, Any]       =   self.unet(
                     sample=UpperCamelCase_					,				timestep=UpperCamelCase_					,				encoder_hidden_states=UpperCamelCase_					,				added_cond_kwargs=UpperCamelCase_					,				return_dict=UpperCamelCase_					,				)[0]

                 if do_classifier_free_guidance:
                       lowerCAmelCase,      lowerCAmelCase					:	List[Any]       =   noise_pred.split(latents.shape[1]					,				dim=1				)
                       lowerCAmelCase,      lowerCAmelCase					:	int       =   noise_pred.chunk(2				)
                       lowerCAmelCase,      lowerCAmelCase					:	int       =   variance_pred.chunk(2				)
                       lowerCAmelCase					:	Any       =   noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
                       lowerCAmelCase					:	List[str]       =   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"]
                 ):
                       lowerCAmelCase,      lowerCAmelCase					:	List[Any]       =   noise_pred.split(latents.shape[1]					,				dim=1				)

                 # compute the previous noisy sample x_t -> x_t-1
                 lowerCAmelCase					:	List[Any]       =   self.scheduler.step(
                     UpperCamelCase_					,				UpperCamelCase_					,				UpperCamelCase_					,				generator=UpperCamelCase_					,				)[0]

           # post-processing
           lowerCAmelCase					:	Optional[int]       =   self.movq.decode(UpperCamelCase_					,				force_not_quantize=UpperCamelCase_				)['''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"]:
                 lowerCAmelCase					:	List[str]       =   image * 0.5 + 0.5
                 lowerCAmelCase					:	Optional[Any]       =   image.clamp(0					,				1				)
                 lowerCAmelCase					:	str       =   image.cpu().permute(0					,				2					,				3					,				1				).float().numpy()

           if output_type == "pil":
                 lowerCAmelCase					:	int       =   self.numpy_to_pil(UpperCamelCase_				)

           if not return_dict:
                 return (image,)

           return ImagePipelineOutput(images=UpperCamelCase_				)






"""simple docstring"""





import os
import tempfile
import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
 import torch
 from torch import nn

 from transformers import (
     Adafactor,
     AdamW,
     get_constant_schedule,
     get_constant_schedule_with_warmup,
     get_cosine_schedule_with_warmup,
     get_cosine_with_hard_restarts_schedule_with_warmup,
     get_inverse_sqrt_schedule,
     get_linear_schedule_with_warmup,
     get_polynomial_decay_schedule_with_warmup,
 )


def      _snake_case						(						_snake_case				:			Tuple ,   _snake_case				:			Union[str, Any]=10			):
      lowerCAmelCase					:	Dict       =   []
      for _ in range(_snake_case			):
            lrs.append(scheduler.get_lr()[0]			)
            scheduler.step()
      return lrs


def      _snake_case						(						_snake_case				:			Optional[int] ,   _snake_case				:			int=10			):
      lowerCAmelCase					:	Optional[int]       =   []
      for step in range(_snake_case			):
            lrs.append(scheduler.get_lr()[0]			)
            scheduler.step()
            if step == num_steps // 2:
                  with tempfile.TemporaryDirectory() as tmpdirname:
                        lowerCAmelCase					:	List[str]       =   os.path.join(_snake_case ,   '''schedule.bin'''			)
                        torch.save(scheduler.state_dict() ,   _snake_case			)

                        lowerCAmelCase					:	List[Any]       =   torch.load(_snake_case			)
                        scheduler.load_state_dict(_snake_case			)
      return lrs



@require_torch
class 		snake_case_(       unittest.TestCase			):






     def      lowerCamelCase__     (	self  :					Optional[int]					,				UpperCamelCase_  :					Optional[int]					,				UpperCamelCase_  :					str					,				UpperCamelCase_  :					Any				):
           self.assertEqual(len(UpperCamelCase_				)					,				len(UpperCamelCase_				)				)
           for a, b in zip(UpperCamelCase_					,				UpperCamelCase_				):
                 self.assertAlmostEqual(UpperCamelCase_					,				UpperCamelCase_					,				delta=UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Tuple				):
           lowerCAmelCase					:	Any       =   torch.tensor([0.1, -0.2, -0.1]					,				requires_grad=UpperCamelCase_				)
           lowerCAmelCase					:	List[str]       =   torch.tensor([0.4, 0.2, -0.5]				)
           lowerCAmelCase					:	List[Any]       =   nn.MSELoss()
           # No warmup, constant schedule, no gradient clipping
           lowerCAmelCase					:	Union[str, Any]       =   AdamW(params=[w]					,				lr=2E-1					,				weight_decay=0.0				)
           for _ in range(1_0_0				):
                 lowerCAmelCase					:	Union[str, Any]       =   criterion(UpperCamelCase_					,				UpperCamelCase_				)
                 loss.backward()
                 optimizer.step()
                 w.grad.detach_()  # No zero_grad() function on simple tensors. we do it ourselves.
                 w.grad.zero_()
           self.assertListAlmostEqual(w.tolist()					,				[0.4, 0.2, -0.5]					,				tol=1E-2				)






     def      lowerCamelCase__     (	self  :					Union[str, Any]				):
           lowerCAmelCase					:	Tuple       =   torch.tensor([0.1, -0.2, -0.1]					,				requires_grad=UpperCamelCase_				)
           lowerCAmelCase					:	Union[str, Any]       =   torch.tensor([0.4, 0.2, -0.5]				)
           lowerCAmelCase					:	Optional[int]       =   nn.MSELoss()
           # No warmup, constant schedule, no gradient clipping
           lowerCAmelCase					:	Any       =   Adafactor(
               params=[w]					,				lr=1E-2					,				eps=(1E-30, 1E-3)					,				clip_threshold=1.0					,				decay_rate=-0.8					,				betaa=UpperCamelCase_					,				weight_decay=0.0					,				relative_step=UpperCamelCase_					,				scale_parameter=UpperCamelCase_					,				warmup_init=UpperCamelCase_					,				)
           for _ in range(1_0_0_0				):
                 lowerCAmelCase					:	List[Any]       =   criterion(UpperCamelCase_					,				UpperCamelCase_				)
                 loss.backward()
                 optimizer.step()
                 w.grad.detach_()  # No zero_grad() function on simple tensors. we do it ourselves.
                 w.grad.zero_()
           self.assertListAlmostEqual(w.tolist()					,				[0.4, 0.2, -0.5]					,				tol=1E-2				)



@require_torch
class 		snake_case_(       unittest.TestCase			):
     __UpperCamelCase  =					nn.Linear(50							,					50			) if is_torch_available() else None
     __UpperCamelCase  =					AdamW(m.parameters()							,					lr=10.0			) if is_torch_available() else None
     __UpperCamelCase  =					10






     def      lowerCamelCase__     (	self  :					Union[str, Any]					,				UpperCamelCase_  :					str					,				UpperCamelCase_  :					str					,				UpperCamelCase_  :					Optional[Any]					,				UpperCamelCase_  :					Union[str, Any]=None				):
           self.assertEqual(len(UpperCamelCase_				)					,				len(UpperCamelCase_				)				)
           for a, b in zip(UpperCamelCase_					,				UpperCamelCase_				):
                 self.assertAlmostEqual(UpperCamelCase_					,				UpperCamelCase_					,				delta=UpperCamelCase_					,				msg=UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Union[str, Any]				):
           lowerCAmelCase					:	Tuple       =   {'''num_warmup_steps''': 2, '''num_training_steps''': 1_0}
           # schedulers doct format
           # function: (sched_args_dict, expected_learning_rates)
           lowerCAmelCase					:	Optional[Any]       =   {
               get_constant_schedule: ({}, [10.0] * self.num_steps),
               get_constant_schedule_with_warmup: (
                   {'''num_warmup_steps''': 4},
                   [0.0, 2.5, 5.0, 7.5, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0],
               ),
               get_linear_schedule_with_warmup: (
                   {**common_kwargs},
                   [0.0, 5.0, 10.0, 8.75, 7.5, 6.25, 5.0, 3.75, 2.5, 1.25],
               ),
               get_cosine_schedule_with_warmup: (
                   {**common_kwargs},
                   [0.0, 5.0, 10.0, 9.61, 8.53, 6.91, 5.0, 3.08, 1.46, 0.38],
               ),
               get_cosine_with_hard_restarts_schedule_with_warmup: (
                   {**common_kwargs, '''num_cycles''': 2},
                   [0.0, 5.0, 10.0, 8.53, 5.0, 1.46, 10.0, 8.53, 5.0, 1.46],
               ),
               get_polynomial_decay_schedule_with_warmup: (
                   {**common_kwargs, '''power''': 2.0, '''lr_end''': 1E-7},
                   [0.0, 5.0, 10.0, 7.656, 5.625, 3.906, 2.5, 1.406, 0.625, 0.156],
               ),
               get_inverse_sqrt_schedule: (
                   {'''num_warmup_steps''': 2},
                   [0.0, 5.0, 10.0, 8.165, 7.071, 6.325, 5.774, 5.345, 5.0, 4.714],
               ),
           }

           for scheduler_func, data in scheds.items():
                 lowerCAmelCase,      lowerCAmelCase					:	Union[str, Any]       =   data

                 lowerCAmelCase					:	List[Any]       =   scheduler_func(self.optimizer					,				**UpperCamelCase_				)
                 self.assertEqual(len([scheduler.get_lr()[0]]				)					,				1				)
                 lowerCAmelCase					:	str       =   unwrap_schedule(UpperCamelCase_					,				self.num_steps				)
                 self.assertListAlmostEqual(
                     UpperCamelCase_					,				UpperCamelCase_					,				tol=1E-2					,				msg=F'''failed for {scheduler_func} in normal scheduler'''					,				)

                 lowerCAmelCase					:	Optional[int]       =   scheduler_func(self.optimizer					,				**UpperCamelCase_				)
                 if scheduler_func.__name__ != "get_constant_schedule":
                       LambdaScheduleWrapper.wrap_scheduler(UpperCamelCase_				)  # wrap to test picklability of the schedule
                 lowerCAmelCase					:	List[Any]       =   unwrap_and_save_reload_schedule(UpperCamelCase_					,				self.num_steps				)
                 self.assertListEqual(UpperCamelCase_					,				UpperCamelCase_					,				msg=F'''failed for {scheduler_func} in save and reload'''				)



class 		snake_case_:






     def __init__(	self  :					List[Any]					,				UpperCamelCase_  :					Any				):
           lowerCAmelCase					:	Tuple       =   fn






     def __call__(	self  :					Union[str, Any]					,				*UpperCamelCase_  :					Optional[Any]					,				**UpperCamelCase_  :					List[Any]				):
           return self.fn(*UpperCamelCase_					,				**UpperCamelCase_				)






     @classmethod
     def      lowerCamelCase__     (	self  :					Any					,				UpperCamelCase_  :					Optional[int]				):
           lowerCAmelCase					:	Union[str, Any]       =   list(map(self					,				scheduler.lr_lambdas				)				)


