code: def _save_as_numpy(
      predictions, output_directory, saved_keys, backend
  ):
      predictions = predictions[
          [c for c in predictions.columns if c not in saved_keys]
      ]
      npy_filename = os.path.join(output_directory, "{}.npy")
      numpy_predictions = to_numpy_dataset(predictions, backend)
      for k, v in numpy_predictions.items():
          k = k.replace("<", "[").replace(
              ">", "]"
          )  # Replace <UNK> and <PAD> with [UNK], [PAD]
          if k not in saved_keys:
              if has_remote_protocol(output_directory):
                  with open_file(
                      npy_filename.format(make_safe_filename(k)),
                      mode="wb",
                  ) as f:
                      np.save(f, v)
              else:
                  np.save(npy_filename.format(make_safe_filename(k)), v)
              saved_keys.add(k)
  
file_path: ludwig/ludwig/data/postprocessing.py
imports: import os
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  import torch
  from ludwig.backend import LOCAL_BACKEND
  from ludwig.data.utils import convert_to_dict
  from ludwig.utils.data_utils import DATAFRAME_FORMATS, DICT_FORMATS
  from ludwig.utils.dataframe_utils import to_numpy_dataset
  from ludwig.utils.fs_utils import has_remote_protocol, open_file
  from ludwig.utils.misc_utils import get_from_registry
  from ludwig.utils.strings_utils import make_safe_filename
  from ludwig.utils.types import DataFrame
label_desc: Use image node_id 2 for calling a global function with example usage: _save_as_numpy(predictions, output_directory, saved_keys, backend) without return types