code: def command_reduce(model_file, target_dim, if_exists):
      """
      Given a `model_file`, this function reduces its dimension to `target_dim`
      by applying a PCA.
      """
      eprint("Loading model")
  
      ft = fasttext.load_model(model_file)
      initial_dim = ft.get_dimension()
      if target_dim >= initial_dim:
          raise Exception(
              "Target dimension (%d) should be less than initial dimension (%d)."
              % (target_dim, initial_dim)
          )
  
      result_filename = guess_target_name(
          model_file, initial_dim, target_dim
      )
      if os.path.isfile(result_filename):
          if if_exists == "overwrite":
              pass
          elif if_exists == "strict":
              raise Exception(
                  "File already exists. Use --overwrite to overwrite."
              )
          elif if_exists == "ignore":
              return result_filename
  
      eprint("Reducing matrix dimensions")
      fasttext.util.reduce_model(ft, target_dim)
  
      eprint("Saving model")
      ft.save_model(result_filename)
      eprint("%s saved" % result_filename)
  
      return result_filename
  
file_path: fastText/reduce_model.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import argparse
  import os
  import re
  import sys
  import fasttext
  import fasttext.util
label_desc: Use image node_id 3 for calling a global function with example usage: command_reduce(model_file, target_dim, if_exists) and returns: result_filename, result_filename