code: def convert_to_npz(instances, max_seq_length):
      """Create masked language model and next sentence prediction samples as numpy arrays."""
      input_ids = []
      segment_ids = []
      masked_lm_positions = []
      masked_lm_ids = []
      masked_lm_weights = []
      next_sentence_labels = []
      valid_lengths = []
  
      for inst_index, instance in enumerate(instances):
          features = transform(instance, max_seq_length)
          input_id = features["input_ids"]
          segment_id = features["segment_ids"]
          masked_lm_position = features["masked_lm_positions"]
          masked_lm_id = features["masked_lm_ids"]
          masked_lm_weight = features["masked_lm_weights"]
          next_sentence_label = features["next_sentence_labels"][0]
          valid_length = features["valid_lengths"][0]
  
          input_ids.append(
              np.ascontiguousarray(input_id, dtype="int32")
          )
          segment_ids.append(
              np.ascontiguousarray(segment_id, dtype="int32")
          )
          masked_lm_positions.append(
              np.ascontiguousarray(masked_lm_position, dtype="int32")
          )
          masked_lm_ids.append(
              np.ascontiguousarray(masked_lm_id, dtype="int32")
          )
          masked_lm_weights.append(
              np.ascontiguousarray(masked_lm_weight, dtype="float32")
          )
          next_sentence_labels.append(next_sentence_label)
          valid_lengths.append(valid_length)
          # debugging information
          if inst_index < 1:
              print_example(instance, features)
      return (
          input_ids,
          masked_lm_ids,
          masked_lm_positions,
          masked_lm_weights,
          next_sentence_labels,
          segment_ids,
          valid_lengths,
      )
  
imports: import argparse
  import logging
  import io
  import os
  import glob
  import collections
  import warnings
  import random
  import time
  from multiprocessing import Pool
  import numpy
  from gluonnlp.models.bert import BertModel, BertForPretrain, get_pretrained_bert
  import gluonnlp
label_desc: Use image node_id 5 for calling a global function with example usage: convert_to_npz(instances, max_seq_length) and returns: input_ids,  masked_lm_ids,  masked_lm_positions,  masked_lm_weights,  next_sentence_labels,  segment_ids,  valid_lengths