code: def main():
      setup_logging()
      parser = argparse.ArgumentParser(
          description="Example on Livejournal"
      )
      parser.add_argument(
          "--config", default=DEFAULT_CONFIG, help="Path to config file"
      )
      parser.add_argument("-p", "--param", action="append", nargs="*")
      parser.add_argument(
          "--data_dir",
          type=Path,
          default="data",
          help="where to save processed data",
      )
  
      args = parser.parse_args()
  
      # download data
      data_dir = args.data_dir
      data_dir.mkdir(parents=True, exist_ok=True)
      fpath = download_url(URL, data_dir)
      fpath = extract_gzip(fpath)
      print("Downloaded and extracted file.")
  
      # random split file for train and test
      random_split_file(fpath)
  
      loader = ConfigFileLoader()
      config = loader.load_config(args.config, args.param)
      set_logging_verbosity(config.verbose)
      subprocess_init = SubprocessInitializer()
      subprocess_init.register(setup_logging, config.verbose)
      subprocess_init.register(add_to_sys_path, loader.config_dir.name)
      input_edge_paths = [data_dir / name for name in FILENAMES]
      output_train_path, output_test_path = config.edge_paths
  
      convert_input_data(
          config.entities,
          config.relations,
          config.entity_path,
          config.edge_paths,
          input_edge_paths,
          TSVEdgelistReader(lhs_col=0, rhs_col=1, rel_col=None),
          dynamic_relations=config.dynamic_relations,
      )
  
      train_config = attr.evolve(config, edge_paths=[output_train_path])
      train(train_config, subprocess_init=subprocess_init)
  
      eval_config = attr.evolve(config, edge_paths=[output_test_path])
      do_eval(eval_config, subprocess_init=subprocess_init)
  
file_path: PyTorch-BigGraph/torchbiggraph/examples/livejournal.py
imports: import argparse
  import random
  from pathlib import Path
  import attr
  import pkg_resources
  from torchbiggraph.config import add_to_sys_path, ConfigFileLoader
  from torchbiggraph.converters.importers import convert_input_data, TSVEdgelistReader
  from torchbiggraph.converters.utils import download_url, extract_gzip
  from torchbiggraph.eval import do_eval
  from torchbiggraph.train import train
  from torchbiggraph.util import set_logging_verbosity, setup_logging, SubprocessInitializer
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types