code: def prepare_inputs_for_generation(
      inputs_embeds,
      attention_mask=None,
      past_key_values=None,
      **kwargs,
  ):
      if past_key_values is not None:
          # only last token for inputs_embeds if past is defined in kwargs
          inputs_embeds = inputs_embeds[:, -1:]
  
      return {
          "inputs_embeds": inputs_embeds,
          "attention_mask": attention_mask,
          "past_key_values": past_key_values,
          "use_cache": kwargs.get("use_cache"),
      }
  
imports: import inspect
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import torch
  from transformers import ClapFeatureExtractor, ClapModel, GPT2Model, RobertaTokenizer, RobertaTokenizerFast, SpeechT5HifiGan, T5EncoderModel, T5Tokenizer, T5TokenizerFast
  from ...models import AutoencoderKL
  from ...schedulers import KarrasDiffusionSchedulers
  from ...utils import is_accelerate_available, is_accelerate_version, is_librosa_available, logging, replace_example_docstring
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
  from .modeling_audioldm2 import AudioLDM2ProjectionModel, AudioLDM2UNet2DConditionModel
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_inputs_for_generation(inputs_embeds, attention_mask, past_key_values) and returns: dict