code: def gen_nsp_input(self, token_ids, pred_ids):
      token_ids = token_ids.numpy()
      pred_ids = pred_ids.numpy()
  
      def __reader__():
          headers = ["src", "tgt", "data_id"]
  
          Example = namedtuple("Example", headers)
  
          for i, (raw, pred) in enumerate(zip(token_ids, pred_ids)):
              context = post_process_context(
                  raw, self.nsp_reader, merge=False
              )
              _, response = post_process_response(
                  pred, self.nsp_reader, merge=False
              )
              context_tokenized_input = " [SEP] ".join(
                  " ".join(utt) for utt in context
              )
              response_tokenized_input = " ".join(response)
              example = Example(
                  src=context_tokenized_input,
                  tgt=response_tokenized_input,
                  data_id=i,
              )
              data = self.nsp_reader._convert_example_to_record(
                  example, is_infer=True
              )
              yield data
          return
  
      generator = self.nsp_reader.data_generator(
          reader=__reader__,
          is_infer=True,
          phase="test",
      )
      inputs = next(generator())
  
      # print('\nnsp_inputs:')
      for key in inputs:
          inputs[key] = paddle.to_tensor(inputs[key])
          if key in ["token_ids", "type_ids", "pos_ids"]:
              inputs[key] = paddle.squeeze(inputs[key], axis=-1)
          # print(key, inputs[key].shape)
          # print(inputs[key])
      return inputs
  
imports: from collections import namedtuple
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 4 for calling the Plato2InferModel obj's underlying member method code with example usage: obj.gen_nsp_input(token_ids, pred_ids) and returns: inputs