code: def model_selection_trails(params: dict, args: Namespace):
      from src.logger import logger
  
      logger.info(f"begin run model_selection_trails CPU  + GPU")
  
      mini_batch_data = json.loads(params["mini_batch"])
      budget = float(params["budget"])
  
      # 1. launch cache service
      columns = list(mini_batch_data[0].keys())
      requests.post(
          args.cache_svc_url,
          json={
              "columns": columns,
              "name_space": "train",
              "table_name": "dummy",
              "batch_size": len(mini_batch_data),
          },
      )
      requests.post(
          args.cache_svc_url,
          json={
              "columns": columns,
              "name_space": "valid",
              "table_name": "dummy",
              "batch_size": len(mini_batch_data),
          },
      )
  
      from src.eva_engine.run_ms import RunModelSelection
  
      # 2. profiling & coordination
      dataloader = generate_dataloader(
          mini_batch_data=mini_batch_data, args=args
      )
      data_loader = [dataloader, dataloader, dataloader]
      rms = RunModelSelection(
          args.search_space, args, is_simulate=args.is_simulate
      )
  
      begin_time = time.time()
      score_time_per_model = rms.profile_filtering(data_loader)
      train_time_per_epoch = rms.profile_refinement(data_loader)
      K, U, N = rms.coordination(
          budget, score_time_per_model, train_time_per_epoch, False
      )
  
      # 3. filtering
      (
          k_models,
          all_models,
          p1_trace_highest_score,
          p1_trace_highest_scored_models_id,
      ) = rms.filtering_phase(N, K, train_loader=data_loader[0])
  
      # 4. Run refinement pahse
      data = {
          "u": 1,
          "k_models": k_models,
          "table_name": "dummy",
          "config_file": args.config_file,
      }
      response = requests.post(args.refinement_url, json=data).json()
  
      best_arch, best_arch_performance = (
          response["best_arch"],
          response["best_arch_performance"],
      )
  
      end_time = time.time()
      real_time_usage = end_time - begin_time
  
      return orjson.dumps(
          {
              "best_arch": best_arch,
              "best_arch_performance": best_arch_performance,
              "time_usage": real_time_usage,
          }
      ).decode("utf-8")
  
imports: import calendar
  import os
  import time
  import requests
  import json
  from typing import List, Dict
  import traceback
  import orjson
  from argparse import Namespace
  from shared_config import parse_config_arguments
  from torch.utils.data import Dataset
  import torch
label_desc: Use image node_id 12 for calling a global function with example usage: model_selection_trails(params, args) and returns: orjson