code: def make_experience_batch(items: List[BufferItem]) -> Experience:
      kwargs = {}
      to_pad_keys = set(("action_log_probs", "action_mask"))
      keys = (
          "sequences",
          "action_log_probs",
          "values",
          "reward",
          "advantages",
          "attention_mask",
          "action_mask",
      )
      for key in keys:
          vals = [getattr(item, key) for item in items]
          if key in to_pad_keys:
              batch_data = _zero_pad_sequences(vals)
          else:
              batch_data = torch.stack(vals, dim=0)
          kwargs[key] = batch_data
      return Experience(**kwargs)
  
file_path: ColossalAI/applications/Chat/coati/experience_buffer/utils.py
imports: from dataclasses import dataclass
  from typing import List, Optional
  import torch
  import torch.nn.functional
  from coati.experience_maker.base import Experience
label_desc: Use image node_id 3 for calling a global function with example usage: make_experience_batch(items) and returns: Experience