code: def save_lora_weights(unet, text_encoder, output_dir):
      unet_lora_layers_to_save = None
      text_encoder_lora_layers_to_save = None
  
      unet_lora_layers_to_save = unet_attn_processors_state_dict(unet)
      text_encoder_lora_layers_to_save = text_encoder_lora_state_dict(
          text_encoder
      )
  
      LoraLoaderMixin.save_lora_weights(
          output_dir,
          unet_lora_layers=unet_lora_layers_to_save,
          text_encoder_lora_layers=text_encoder_lora_layers_to_save,
      )
  
imports: from typing import Dict
  import itertools
  from diffusers import AutoencoderKL, DDPMScheduler, DiffusionPipeline, UNet2DConditionModel
  from diffusers.loaders import LoraLoaderMixin, text_encoder_lora_state_dict
  from diffusers.models.attention_processor import AttnAddedKVProcessor, AttnAddedKVProcessor2_0, LoRAAttnAddedKVProcessor, LoRAAttnProcessor, LoRAAttnProcessor2_0, SlicedAttnAddedKVProcessor
  from diffusers.utils.import_utils import is_xformers_available
  from ray.train import ScalingConfig
  from ray import train
  from ray.train.torch import TorchTrainer
  import torch
  import torch.nn.functional
  from torch.nn.utils import clip_grad_norm_
  from transformers import CLIPTextModel
  from dataset import collate, get_train_dataset
  from flags import train_arguments
label_desc: Use image node_id 7 for calling a global function with example usage: save_lora_weights(unet, text_encoder, output_dir) without return types