code: def build_from_dump(opt, write_path, dump_dir):
      # set up chats
      chats = read_dumps(dump_dir)
      filtered_chats = filter_chats(chats)
      valid_choice_chats = filtered_chats[:10000]
      remaining_chats = filtered_chats[10000:]
      rand = random.Random(3)
      rand.shuffle(valid_choice_chats)
  
      # Construct a validation and test set with a preset cutoff
      above_test_cutoff = remove_under_score_cutoff(
          valid_choice_chats, score_cutoff=LIGHT_TEST_CUTOFF
      )
      below_test_cutoff = [
          c
          for c in valid_choice_chats
          if c["score"] < LIGHT_TEST_CUTOFF
      ]
  
      test_chats = above_test_cutoff[:1000]
      valid_chats = above_test_cutoff[1000:1500]
      remaining_chats += above_test_cutoff[1500:]
  
      trainable_chats = remaining_chats + below_test_cutoff
      if opt["light_use_hard_score_cutoff"]:
          train_chats = remove_except_score_cutoff(
              trainable_chats,
              score_cutoff=opt["light_use_score_cutoff"],
          )
      elif opt["light_use_max_score_cutoff"] > 0:
          train_chats = remove_over_score_cutoff(
              trainable_chats,
              score_cutoff=opt["light_use_max_score_cutoff"],
          )
      else:
          train_chats = remove_under_score_cutoff(
              trainable_chats,
              score_cutoff=opt["light_use_score_cutoff"],
          )
  
      if opt.get("light_model_name"):
          model_name = opt["light_model_name"].split("+")
          assert all(m in CURRENT_HOBBOT_MODELS for m in model_name)
          train_chats = sum(
              [filter_by_model(train_chats, m) for m in model_name], []
          )
  
      if opt["light_use_continue_type"] != "all":
          train_chats = filter_by_continue_type(
              train_chats, opt["light_use_continue_type"]
          )
  
      if opt.get("light_use_date_cutoff"):
          date_cutoff = opt["light_use_date_cutoff"]
          train_chats = filter_by_chat_date(train_chats, date_cutoff)
  
      write_out_candidates(test_chats, write_path, "test")
      write_alldata(opt, test_chats, write_path, "speech", "test")
  
      write_out_candidates(valid_chats, write_path, "valid")
      write_alldata(opt, valid_chats, write_path, "speech", "valid")
  
      write_out_candidates(train_chats, write_path, "train")
      write_alldata(opt, train_chats, write_path, "speech", "train")
  
imports: import random
  import io
  import os
  import json
  from parlai.utils.misc import msg_to_str
label_desc: Use image node_id 23 for calling a global function with example usage: build_from_dump(opt, write_path, dump_dir) without return types