code: def prior_original_checkpoint_to_diffusers_checkpoint(
      model, checkpoint, clip_stats_checkpoint
  ):
      diffusers_checkpoint = {}
  
      # <original>.time_embed.0 -> <diffusers>.time_embedding.linear_1
      diffusers_checkpoint.update(
          {
              "time_embedding.linear_1.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.time_embed.0.weight"
              ],
              "time_embedding.linear_1.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.time_embed.0.bias"
              ],
          }
      )
  
      # <original>.clip_img_proj -> <diffusers>.proj_in
      diffusers_checkpoint.update(
          {
              "proj_in.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.clip_img_proj.weight"
              ],
              "proj_in.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.clip_img_proj.bias"
              ],
          }
      )
  
      # <original>.text_emb_proj -> <diffusers>.embedding_proj
      diffusers_checkpoint.update(
          {
              "embedding_proj.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.text_emb_proj.weight"
              ],
              "embedding_proj.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.text_emb_proj.bias"
              ],
          }
      )
  
      # <original>.text_enc_proj -> <diffusers>.encoder_hidden_states_proj
      diffusers_checkpoint.update(
          {
              "encoder_hidden_states_proj.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.text_enc_proj.weight"
              ],
              "encoder_hidden_states_proj.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.text_enc_proj.bias"
              ],
          }
      )
  
      # <original>.positional_embedding -> <diffusers>.positional_embedding
      diffusers_checkpoint.update(
          {
              "positional_embedding": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.positional_embedding"
              ]
          }
      )
  
      # <original>.prd_emb -> <diffusers>.prd_embedding
      diffusers_checkpoint.update(
          {
              "prd_embedding": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.prd_emb"
              ]
          }
      )
  
      # <original>.time_embed.2 -> <diffusers>.time_embedding.linear_2
      diffusers_checkpoint.update(
          {
              "time_embedding.linear_2.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.time_embed.2.weight"
              ],
              "time_embedding.linear_2.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.time_embed.2.bias"
              ],
          }
      )
  
      # <original>.resblocks.<x> -> <diffusers>.transformer_blocks.<x>
      for idx in range(len(model.transformer_blocks)):
          diffusers_transformer_prefix = f"transformer_blocks.{idx}"
          original_transformer_prefix = (
              f"{PRIOR_ORIGINAL_PREFIX}.transformer.resblocks.{idx}"
          )
  
          # <original>.attn -> <diffusers>.attn1
          diffusers_attention_prefix = (
              f"{diffusers_transformer_prefix}.attn1"
          )
          original_attention_prefix = (
              f"{original_transformer_prefix}.attn"
          )
          diffusers_checkpoint.update(
              prior_attention_to_diffusers(
                  checkpoint,
                  diffusers_attention_prefix=diffusers_attention_prefix,
                  original_attention_prefix=original_attention_prefix,
                  attention_head_dim=model.attention_head_dim,
              )
          )
  
          # <original>.mlp -> <diffusers>.ff
          diffusers_ff_prefix = f"{diffusers_transformer_prefix}.ff"
          original_ff_prefix = f"{original_transformer_prefix}.mlp"
          diffusers_checkpoint.update(
              prior_ff_to_diffusers(
                  checkpoint,
                  diffusers_ff_prefix=diffusers_ff_prefix,
                  original_ff_prefix=original_ff_prefix,
              )
          )
  
          # <original>.ln_1 -> <diffusers>.norm1
          diffusers_checkpoint.update(
              {
                  f"{diffusers_transformer_prefix}.norm1.weight": checkpoint[
                      f"{original_transformer_prefix}.ln_1.weight"
                  ],
                  f"{diffusers_transformer_prefix}.norm1.bias": checkpoint[
                      f"{original_transformer_prefix}.ln_1.bias"
                  ],
              }
          )
  
          # <original>.ln_2 -> <diffusers>.norm3
          diffusers_checkpoint.update(
              {
                  f"{diffusers_transformer_prefix}.norm3.weight": checkpoint[
                      f"{original_transformer_prefix}.ln_2.weight"
                  ],
                  f"{diffusers_transformer_prefix}.norm3.bias": checkpoint[
                      f"{original_transformer_prefix}.ln_2.bias"
                  ],
              }
          )
  
      # <original>.final_ln -> <diffusers>.norm_out
      diffusers_checkpoint.update(
          {
              "norm_out.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.final_ln.weight"
              ],
              "norm_out.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.final_ln.bias"
              ],
          }
      )
  
      # <original>.out_proj -> <diffusers>.proj_to_clip_embeddings
      diffusers_checkpoint.update(
          {
              "proj_to_clip_embeddings.weight": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.out_proj.weight"
              ],
              "proj_to_clip_embeddings.bias": checkpoint[
                  f"{PRIOR_ORIGINAL_PREFIX}.out_proj.bias"
              ],
          }
      )
  
      # clip stats
      clip_mean, clip_std = clip_stats_checkpoint
      clip_mean = clip_mean[None, :]
      clip_std = clip_std[None, :]
  
      diffusers_checkpoint.update(
          {"clip_mean": clip_mean, "clip_std": clip_std}
      )
  
      return diffusers_checkpoint
  
imports: import argparse
  import os
  import tempfile
  import torch
  from accelerate import load_checkpoint_and_dispatch
  from diffusers import UNet2DConditionModel
  from diffusers.models.prior_transformer import PriorTransformer
  from diffusers.models.vq_model import VQModel
label_desc: Use image node_id 2 for calling a global function with example usage: prior_original_checkpoint_to_diffusers_checkpoint(model, checkpoint, clip_stats_checkpoint) and returns: diffusers_checkpoint