



'''simple docstring'''



def      _A				(      _lowerCAmelCase=28_123    ):



							"""simple docstring"""



							__lowercase						=[1] * (limit + 1)

							for i in range(2     ,      int(limit**0.5    ) + 1    ):
														sum_divs[i * i] += i
														for k in range(i + 1     ,      limit // i + 1    ):
																					sum_divs[k * i] += k + i

							__lowercase						=set()
							__lowercase						=0

							for n in range(1     ,      limit + 1    ):
														if sum_divs[n] > n:
																					abundants.add(__snake_case    )

														if not any((n - a in abundants) for a in abundants    ):
																					res += n

							return res


if __name__ == "__main__":
		print(solution())





"""simple docstring"""




import argparse

import OmegaConf
import torch

from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel


def   __magic_name__	(      __snake_case				:       List[str]     , __snake_case				:       Tuple     , __snake_case				:       Tuple  ) ->				int:
       lowercase    :				Union[str, Any]       		=							OmegaConf.load(__snake_case  )
       lowercase    :				int       		=							torch.load(__snake_case     , map_location="cpu"  )["model"]
       lowercase    :				Optional[Any]       		=							list(state_dict.keys()  )

       # extract state_dict for VQVAE
       lowercase    :				Optional[int]       		=							{}
       lowercase    :				Union[str, Any]       		=							"first_stage_model."
       for key in keys:
              if key.startswith(__snake_case  ):
                     lowercase    :				List[Any]       		=							state_dict[key]

    # extract state_dict for UNetLDM
       lowercase    :				Optional[int]       		=							{}
       lowercase    :				List[Any]       		=							"model.diffusion_model."
       for key in keys:
              if key.startswith(__snake_case  ):
                     lowercase    :				Optional[Any]       		=							state_dict[key]

       lowercase    :				Dict       		=							config.model.params.first_stage_config.params
       lowercase    :				List[str]       		=							config.model.params.unet_config.params

       lowercase    :				Union[str, Any]       		=							VQModel(**__snake_case  ).eval()
       vqvae.load_state_dict(__snake_case  )

       lowercase    :				List[Any]       		=							UNetLDMModel(**__snake_case  ).eval()
       unet.load_state_dict(__snake_case  )

       lowercase    :				Dict       		=							DDIMScheduler(
           timesteps=config.model.params.timesteps     , beta_schedule="scaled_linear"     , beta_start=config.model.params.linear_start     , beta_end=config.model.params.linear_end     , clip_sample=__snake_case     , )

       lowercase    :				Optional[Any]       		=							LDMPipeline(__snake_case     , __snake_case     , __snake_case  )
       pipeline.save_pretrained(__snake_case  )


if __name__ == "__main__":
   _A			:       Optional[Any]   		=       argparse.ArgumentParser()
   parser.add_argument("""--checkpoint_path""", type=str, required=True)
   parser.add_argument("""--config_path""", type=str, required=True)
   parser.add_argument("""--output_path""", type=str, required=True)
   _A			:       Dict   		=       parser.parse_args()

   convert_ldm_original(args.checkpoint_path, args.config_path, args.output_path)


