def convert_cogview4_vae_checkpoint_to_diffusers(ckpt_path, vae_config):
    """
    Convert a CogView4 VAE checkpoint to Diffusers format.

    Args:
        ckpt_path (str): Path to the VAE checkpoint.
        vae_config (dict): Configuration dictionary for the VAE.

    Returns:
        dict: The converted VAE state dictionary compatible with Diffusers.
    """
    original_state_dict = torch.load(ckpt_path, map_location="cpu", weights_only=False)["state_dict"]
    return convert_ldm_vae_checkpoint(original_state_dict, vae_config)

    Convert a CogView4 VAE checkpoint to Diffusers format.

    Args:
        ckpt_path (str): Path to the VAE checkpoint.
        vae_config (dict): Configuration dictionary for the VAE.

    Returns:
        dict: The converted VAE state dictionary compatible with Diffusers.
    
scripts/convert_cogview4_to_diffusers_megatron.py