code: def __init__(
      self,
      dataset: MetaDataset,
      work_dir: Path,
      fixed_params: Dict,
      cuda_device: int,
      key_factor: str = "loss",
      min_mode: bool = True,
      resume: bool = False,
  ):
      self.dataset = dataset
      self.param_names, self.varied_params = zip(
          *sorted(dataset.hyperparam_space.items(), key=lambda x: x[0])
      )
      self.fixed_params = fixed_params
      self.work_dir = work_dir
      self.work_dir.mkdir(parents=True, exist_ok=True)
      self.cuda_device = cuda_device
      self.key_factor = key_factor
      self.min_mode = min_mode
  
      self.exp_ids = OrderedDict()
      self.records = OrderedDict()
      if resume:
          self.load_records()
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Optional, Dict, Tuple, List, Union
  from collections import OrderedDict
  from pathlib import Path
  from itertools import product
  from functools import reduce
  import traceback
  import textwrap
  import socket
  import json
  import torch
  import numpy
  import pandas
  from .distributed import is_main_process, synchronize
label_desc: Use image node_id 1 to create a new HyperOptManager object from inherited base classes: object with example: obj = HyperOptManager(dataset, work_dir, fixed_params, cuda_device, key_factor, min_mode, resume)