




'''simple docstring'''


import argparse

import OmegaConf
import torch

from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel
def 	snake_case_					(UpperCamelCase :						str				,		UpperCamelCase :						List[str]				,		UpperCamelCase :						Optional[Any]   ):
							_a			  =       OmegaConf.load(lowerCamelCase__   )
							_a			  =       torch.load(lowerCamelCase__				,		map_location='''cpu'''   )["model"]
							_a			  =       list(state_dict.keys()   )

							# extract state_dict for VQVAE
							_a			  =       {}
							_a			  =       "first_stage_model."
							for key in keys:
														if key.startswith(lowerCamelCase__   ):
																					_a			  =       state_dict[key]

    # extract state_dict for UNetLDM
							_a			  =       {}
							_a			  =       "model.diffusion_model."
							for key in keys:
														if key.startswith(lowerCamelCase__   ):
																					_a			  =       state_dict[key]

							_a			  =       config.model.params.first_stage_config.params
							_a			  =       config.model.params.unet_config.params

							_a			  =       VQModel(**lowerCamelCase__   ).eval()
							vqvae.load_state_dict(lowerCamelCase__   )

							_a			  =       UNetLDMModel(**lowerCamelCase__   ).eval()
							unet.load_state_dict(lowerCamelCase__   )

							_a			  =       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=lowerCamelCase__				,		)

							_a			  =       LDMPipeline(lowerCamelCase__				,		lowerCamelCase__				,		lowerCamelCase__   )
							pipeline.save_pretrained(lowerCamelCase__   )


if __name__ == "__main__":
				_snake_case   :   str     							=	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)
				_snake_case   :   int     							=	parser.parse_args()

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







'''simple docstring'''


def 	snake_case_					(UpperCamelCase :						int   ):





							'''simple docstring'''


							if n == 1 or not isinstance(UpperCamelCase				,		UpperCamelCase   ):
														return 0
							elif n == 2:
														return 1
							else:
														_a			  =       [0, 1]
														for i in range(2				,		n + 1   ):
																					sequence.append(sequence[i - 1] + sequence[i - 2]   )

														return sequence[n]
def 	snake_case_					(UpperCamelCase :						int   ):





							'''simple docstring'''


							_a			  =       0
							_a			  =       2

							while digits < n:
														index += 1
														_a			  =       len(str(fibonacci(UpperCamelCase   )   )   )

							return index
def 	snake_case_					(UpperCamelCase :						int = 1000   ):





							'''simple docstring'''


							return fibonacci_digits_index(UpperCamelCase   )


if __name__ == "__main__":
				print(solution(int(str(input()).strip())))

