code: def write_to_files_np(
      features,
      tokenizer,
      max_seq_length,
      max_predictions_per_seq,
      output_files,
  ):
      # pylint: disable=unused-argument
      """Write to numpy files from `TrainingInstance`s."""
      next_sentence_labels = []
      valid_lengths = []
  
      assert (
          len(output_files) == 1
      ), "numpy format only support single output file"
      output_file = output_files[0]
      (
          input_ids,
          segment_ids,
          masked_lm_positions,
          masked_lm_ids,
          masked_lm_weights,
          next_sentence_labels,
          valid_lengths,
      ) = features
      total_written = len(next_sentence_labels)
  
      # store variable length numpy array object directly.
      outputs = collections.OrderedDict()
      outputs["input_ids"] = np.array(input_ids, dtype=object)
      outputs["segment_ids"] = np.array(segment_ids, dtype=object)
      outputs["masked_lm_positions"] = np.array(
          masked_lm_positions, dtype=object
      )
      outputs["masked_lm_ids"] = np.array(masked_lm_ids, dtype=object)
      outputs["masked_lm_weights"] = np.array(
          masked_lm_weights, dtype=object
      )
      outputs["next_sentence_labels"] = np.array(
          next_sentence_labels, dtype="int32"
      )
      outputs["valid_lengths"] = np.array(valid_lengths, dtype="int32")
  
      np.savez_compressed(output_file, **outputs)
      logging.info("Wrote %d total instances", total_written)
  
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 3 for calling a global function with example usage: write_to_files_np(features, tokenizer, max_seq_length, max_predictions_per_seq, output_files) without return types