code: def padSeqs_gpt(sequences, pad_id, maxlen=None):
      lengths = []
      for x in sequences:
          lengths.append(len(x))
  
      num_samples = len(sequences)
      seq_mexlen = np.max(lengths)
  
      if seq_mexlen > 1024:
          maxlen = 1024
      else:
          maxlen = seq_mexlen
  
      x = np.ones((num_samples, maxlen)) * pad_id
      for idx, s in enumerate(sequences):
          if not len(s):
              print("empty list was found in padSeqs")
          # trunc method = 'pre'
          trunc = s[-maxlen:]
          trunc = np.asarray(trunc)
  
          # pad method = 'post'
          x[idx, : len(trunc)] = trunc
  
      return x, lengths
  
imports: import logging
  import json
  import numpy
  from collections import OrderedDict
  from .None import ontology
label_desc: Use image node_id 4 for calling a global function with example usage: padSeqs_gpt(sequences, pad_id, maxlen) and returns: x,  lengths