



import torch

from diffusers import DPMSolverSDEScheduler
from diffusers.utils import torch_device
from diffusers.utils.testing_utils import require_torchsde

from .test_schedulers import SchedulerCommonTest
@require_torchsde
class    __UpperCamelCase			(       _a				):

 """simple docstring"""



 _lowercase   :    List[Any]      						=					(DPMSolverSDEScheduler,)
 _lowercase   :    str      						=					10

 def 						_UpperCAmelCase       (	self		,				**SCREAMING_SNAKE_CASE      ) ->			List[Any]:
  a__												= {
      """num_train_timesteps""": 1_1_0_0,
      """beta_start""": 0.00_01,
      """beta_end""": 0.02,
      """beta_schedule""": """linear""",
      """noise_sampler_seed""": 0,
  }

  config.update(**snake_case_      )
  return config

 def 						_UpperCAmelCase       (	self      ) ->			Optional[Any]:
  for timesteps in [1_0, 5_0, 1_0_0, 1_0_0_0]:
   self.check_over_configs(num_train_timesteps=snake_case_      )

 def 						_UpperCAmelCase       (	self      ) ->			Tuple:
  for beta_start, beta_end in zip([0.0_00_01, 0.00_01, 0.0_01]		,				[0.00_02, 0.0_02, 0.02]      ):
   self.check_over_configs(beta_start=snake_case_		,				beta_end=snake_case_      )

 def 						_UpperCAmelCase       (	self      ) ->			str:
  for schedule in ["linear", "scaled_linear"]:
   self.check_over_configs(beta_schedule=snake_case_      )

 def 						_UpperCAmelCase       (	self      ) ->			int:
  for prediction_type in ["epsilon", "v_prediction"]:
   self.check_over_configs(prediction_type=snake_case_      )

 def 						_UpperCAmelCase       (	self      ) ->			int:
  a__												= self.scheduler_classes[0]
  a__												= self.get_scheduler_config()
  a__												= scheduler_class(**snake_case_      )

  scheduler.set_timesteps(self.num_inference_steps      )

  a__												= self.dummy_model()
  a__												= self.dummy_sample_deter * scheduler.init_noise_sigma
  a__												= sample.to(snake_case_      )

  for i, t in enumerate(scheduler.timesteps      ):
   a__												= scheduler.scale_model_input(snake_case_		,				snake_case_      )

   a__												= model(snake_case_		,				snake_case_      )

   a__												= scheduler.step(snake_case_		,				snake_case_		,				snake_case_      )
   a__												= output.prev_sample

  a__												= torch.sum(torch.abs(snake_case_      )      )
  a__												= torch.mean(torch.abs(snake_case_      )      )

  if torch_device in ["mps"]:
   assert abs(result_sum.item() - 1_67.47_82_10_44_92_18_75      ) < 1e-2
   assert abs(result_mean.item() - 0.21_78_70_59_64_56_52_77      ) < 1e-3
  elif torch_device in ["cuda"]:
   assert abs(result_sum.item() - 1_71.59_35_21_11_81_64_06      ) < 1e-2
   assert abs(result_mean.item() - 0.2_23_42_90_68_92_29_96_52      ) < 1e-3
  else:
   assert abs(result_sum.item() - 1_62.52_38_34_22_85_15_62      ) < 1e-2
   assert abs(result_mean.item() - 0.2_11_61_95_70_85_13_26      ) < 1e-3

 def 						_UpperCAmelCase       (	self      ) ->			Dict:
  a__												= self.scheduler_classes[0]
  a__												= self.get_scheduler_config(prediction_type='''v_prediction'''      )
  a__												= scheduler_class(**snake_case_      )

  scheduler.set_timesteps(self.num_inference_steps      )

  a__												= self.dummy_model()
  a__												= self.dummy_sample_deter * scheduler.init_noise_sigma
  a__												= sample.to(snake_case_      )

  for i, t in enumerate(scheduler.timesteps      ):
   a__												= scheduler.scale_model_input(snake_case_		,				snake_case_      )

   a__												= model(snake_case_		,				snake_case_      )

   a__												= scheduler.step(snake_case_		,				snake_case_		,				snake_case_      )
   a__												= output.prev_sample

  a__												= torch.sum(torch.abs(snake_case_      )      )
  a__												= torch.mean(torch.abs(snake_case_      )      )

  if torch_device in ["mps"]:
   assert abs(result_sum.item() - 1_24.77_14_92_00_43_94_53      ) < 1e-2
   assert abs(result_mean.item() - 0.1_62_26_28_90_14_81_62_84      ) < 1e-3
  elif torch_device in ["cuda"]:
   assert abs(result_sum.item() - 1_28.1_66_33_60_59_57_03      ) < 1e-2
   assert abs(result_mean.item() - 0.1_66_88_32_60_01_16_72_97      ) < 1e-3
  else:
   assert abs(result_sum.item() - 1_19.8_48_75_48_82_81_25      ) < 1e-2
   assert abs(result_mean.item() - 0.15_60_53_06_62_53_66_21      ) < 1e-3

 def 						_UpperCAmelCase       (	self      ) ->			List[Any]:
  a__												= self.scheduler_classes[0]
  a__												= self.get_scheduler_config()
  a__												= scheduler_class(**snake_case_      )

  scheduler.set_timesteps(self.num_inference_steps		,				device=snake_case_      )

  a__												= self.dummy_model()
  a__												= self.dummy_sample_deter.to(snake_case_      ) * scheduler.init_noise_sigma

  for t in scheduler.timesteps:
   a__												= scheduler.scale_model_input(snake_case_		,				snake_case_      )

   a__												= model(snake_case_		,				snake_case_      )

   a__												= scheduler.step(snake_case_		,				snake_case_		,				snake_case_      )
   a__												= output.prev_sample

  a__												= torch.sum(torch.abs(snake_case_      )      )
  a__												= torch.mean(torch.abs(snake_case_      )      )

  if torch_device in ["mps"]:
   assert abs(result_sum.item() - 1_67.46_95_73_97_46_09_38      ) < 1e-2
   assert abs(result_mean.item() - 0.2_18_05_93_46_07_98_26_35      ) < 1e-3
  elif torch_device in ["cuda"]:
   assert abs(result_sum.item() - 1_71.59_35_36_37_69_53_12      ) < 1e-2
   assert abs(result_mean.item() - 0.2_23_42_90_83_82_41_57_71      ) < 1e-3
  else:
   assert abs(result_sum.item() - 1_62.52_38_34_22_85_15_62      ) < 1e-2
   assert abs(result_mean.item() - 0.2_11_61_95_70_85_13_26      ) < 1e-3



 def 						_UpperCAmelCase       (	self      ) ->			str:
  a__												= self.scheduler_classes[0]
  a__												= self.get_scheduler_config()
  a__												= scheduler_class(**snake_case_		,				use_karras_sigmas=snake_case_      )

  scheduler.set_timesteps(self.num_inference_steps		,				device=snake_case_      )

  a__												= self.dummy_model()
  a__												= self.dummy_sample_deter.to(snake_case_      ) * scheduler.init_noise_sigma
  a__												= sample.to(snake_case_      )

  for t in scheduler.timesteps:
   a__												= scheduler.scale_model_input(snake_case_		,				snake_case_      )

   a__												= model(snake_case_		,				snake_case_      )

   a__												= scheduler.step(snake_case_		,				snake_case_		,				snake_case_      )
   a__												= output.prev_sample

  a__												= torch.sum(torch.abs(snake_case_      )      )
  a__												= torch.mean(torch.abs(snake_case_      )      )

  if torch_device in ["mps"]:
   assert abs(result_sum.item() - 1_76.66_97_41_35_74_21_88      ) < 1e-2
   assert abs(result_mean.item() - 0.2_30_03_87_27_30_98_18_11      ) < 1e-2
  elif torch_device in ["cuda"]:
   assert abs(result_sum.item() - 1_77.63_65_35_64_45_31_25      ) < 1e-2
   assert abs(result_mean.item() - 0.2_30_03_87_27_30_98_18_11      ) < 1e-2
  else:
   assert abs(result_sum.item() - 1_70.3_13_52_23_38_86_72      ) < 1e-2
   assert abs(result_mean.item() - 0.2_30_03_87_27_30_98_18_11      ) < 1e-2










'''simple docstring'''





import sys

__a  			=						(
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)





def 		__snake_case(							_lowerCAmelCase = N						)						->					int:
      snake_case__    :       Dict       		= -sys.maxsize - 1
      for i in range(len(_lowerCAmelCase						) - 12						):
            snake_case__    :       Any       		= 1
            for j in range(13						):
                  product *= int(n[i + j]						)
            if product > largest_product:
                  snake_case__    :       List[str]       		= product
      return largest_product


if __name__ == "__main__":
       print(F"{solution() = }")
