code: def generate(input_data, output_dir, include_pad=False):
      path_base = os.path.dirname(os.path.realpath(__file__))
  
      if not os.path.exists(output_dir):
          os.makedirs(output_dir)
  
      # Copy required files
      shutil.copy2(path_base + "/templates/tree.css", output_dir)
      shutil.copy2(path_base + "/templates/tree.js", output_dir)
  
      with open(input_data) as beams:
          for i, line in enumerate(beams):
              beam = json.loads(line)
  
              graph = create_graph(
                  predicted_ids=beam["predicted_tokens"],
                  parent_ids=beam["parent_ids"],
                  scores=beam["scores"],
                  normalized_scores=beam["normalized_scores"],
                  include_pad=include_pad,
              )
  
              json_str = json.dumps(
                  json_graph.tree_data(graph, (0, 0)), ensure_ascii=True
              )
  
              html_str = HTML_TEMPLATE.substitute(
                  DATA=json_str, SENT=str(i)
              )
              output_path = os.path.join(
                  output_dir, "{:06d}.html".format(i)
              )
              with open(output_path, "w", encoding="utf-8") as out:
                  out.write(html_str)
      print("Output beams written to: {}".format(output_dir))
  
file_path: sockeye/sockeye_contrib/vistools/generate_graphs.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 json
  import shutil
  from string import Template
  import networkx
  from networkx.readwrite import json_graph
label_desc: Use image node_id 3 for calling a global function with example usage: generate(input_data, output_dir, include_pad) without return types