code: def get_learned_conditioning(
      model,
      prompts: SdConditioning | list[str],
      steps,
      hires_steps=None,
      use_old_scheduling=False,
  ):
      """converts a list of prompts into a list of prompt schedules - each schedule is a list of ScheduledPromptConditioning, specifying the comdition (cond),
      and the sampling step at which this condition is to be replaced by the next one.
  
      Input:
      (model, ['a red crown', 'a [blue:green:5] jeweled crown'], 20)
  
      Output:
      [
          [
              ScheduledPromptConditioning(end_at_step=20, cond=tensor([[-0.3886,  0.0229, -0.0523,  ..., -0.4901, -0.3066,  0.0674], ..., [ 0.3317, -0.5102, -0.4066,  ...,  0.4119, -0.7647, -1.0160]], device='cuda:0'))
          ],
          [
              ScheduledPromptConditioning(end_at_step=5, cond=tensor([[-0.3886,  0.0229, -0.0522,  ..., -0.4901, -0.3067,  0.0673], ..., [-0.0192,  0.3867, -0.4644,  ...,  0.1135, -0.3696, -0.4625]], device='cuda:0')),
              ScheduledPromptConditioning(end_at_step=20, cond=tensor([[-0.3886,  0.0229, -0.0522,  ..., -0.4901, -0.3067,  0.0673], ..., [-0.7352, -0.4356, -0.7888,  ...,  0.6994, -0.4312, -1.2593]], device='cuda:0'))
          ]
      ]
      """
      res = []
  
      prompt_schedules = get_learned_conditioning_prompt_schedules(
          prompts, steps, hires_steps, use_old_scheduling
      )
      cache = {}
  
      for prompt, prompt_schedule in zip(prompts, prompt_schedules):
          cached = cache.get(prompt, None)
          if cached is not None:
              res.append(cached)
              continue
  
          texts = SdConditioning(
              [x[1] for x in prompt_schedule], copy_from=prompts
          )
          conds = model.get_learned_conditioning(texts)
  
          cond_schedule = []
          for i, (end_at_step, _) in enumerate(prompt_schedule):
              if isinstance(conds, dict):
                  cond = {k: v[i] for k, v in conds.items()}
              else:
                  cond = conds[i]
  
              cond_schedule.append(
                  ScheduledPromptConditioning(end_at_step, cond)
              )
  
          cache[prompt] = cond_schedule
          res.append(cond_schedule)
  
      return res
  
imports: from __future__ import annotations
  import re
  from collections import namedtuple
  import lark
label_desc: Use image node_id 2 for calling a global function with example usage: get_learned_conditioning(model, prompts, steps, hires_steps, use_old_scheduling) and returns: res