code: def stack_conds(conds):
      if len(conds) == 1:
          return torch.stack(conds)
  
      # same as in reconstruct_multicond_batch
      token_count = max([x.shape[0] for x in conds])
      for i in range(len(conds)):
          if conds[i].shape[0] != token_count:
              last_vector = conds[i][-1:]
              last_vector_repeated = last_vector.repeat(
                  [token_count - conds[i].shape[0], 1]
              )
              conds[i] = torch.vstack([conds[i], last_vector_repeated])
  
      return torch.stack(conds)
  
imports: import datetime
  import glob
  import html
  import os
  import inspect
  from contextlib import closing
  import modules.textual_inversion.dataset
  import torch
  import tqdm
  from einops import rearrange, repeat
  from ldm.util import default
  from modules import devices, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint, errors
  from modules.textual_inversion import textual_inversion, logging
  from modules.textual_inversion.learn_schedule import LearnRateScheduler
  from torch import einsum
  from torch.nn.init import normal_, xavier_normal_, xavier_uniform_, kaiming_normal_, kaiming_uniform_, zeros_
  from collections import deque
  from statistics import stdev, mean
label_desc: Use image node_id 8 for calling a global function with example usage: stack_conds(conds) and returns: torch, torch