code: def test_meta_schedule_xgb_model_reload():
      extractor = RandomFeatureExtractor()
      model = XGBModel(extractor=extractor, num_warmup_samples=10)
      update_sample_count = 20
      predict_sample_count = 30
      model.update(
          TuneContext(),
          [_dummy_candidate() for i in range(update_sample_count)],
          [_dummy_result() for i in range(update_sample_count)],
      )
      model.predict(
          TuneContext(),
          [_dummy_candidate() for i in range(predict_sample_count)],
      )
      with tempfile.NamedTemporaryFile() as path:
          # Backup
          random_state = (
              model.extractor.random_state
          )  # save feature extractor's random state
          old_data = model.data
          old_data_size = model.data_size
          model.save(path.name)
          res1 = model.predict(
              TuneContext(),
              [_dummy_candidate() for i in range(predict_sample_count)],
          )
          # Load
          model.extractor.random_state = (
              random_state  # load feature extractor's random state
          )
          model.load(path.name)
          new_data = model.data
          new_data_size = model.data_size
          res2 = model.predict(
              TuneContext(),
              [_dummy_candidate() for i in range(predict_sample_count)],
          )
      assert (res1 == res2).all()
      assert old_data_size == new_data_size
      assert len(old_data) == len(new_data)
      for (k1, g1), (k2, g2) in zip(  # pylint: disable=invalid-name
          old_data.items(), new_data.items()
      ):
          assert k1 == k2
          assert k1 == g1.group_hash
          assert k2 == g2.group_hash
          assert (g1.costs == g2.costs).all()
          assert len(g1.features) == len(g2.features)
          for f1, f2 in zip(
              g1.features, g2.features
          ):  # pylint: disable=invalid-name
              assert (f1 == f2).all()
  
imports: import os
  import re
  import shutil
  import tempfile
  import unittest
  from functools import partial
  from typing import List
  import numpy
  import tvm
  import tvm.testing
  from tvm.meta_schedule.cost_model import PyCostModel, RandomModel, XGBModel
  from tvm.meta_schedule.cost_model.xgb_model import PackSum, _get_custom_call_back
  from tvm.meta_schedule.feature_extractor import RandomFeatureExtractor
  from tvm.meta_schedule.runner import RunnerResult
  from tvm.meta_schedule.search_strategy import MeasureCandidate
  from tvm.meta_schedule.tune_context import TuneContext
  from tvm.meta_schedule.utils import derived_object
  from tvm.script import tir
  from tvm.tir.schedule.schedule import Schedule
label_desc: Use image node_id 10 for calling a global function with example usage: test_meta_schedule_xgb_model_reload() without return types