code: def botorch_component_from_json(
      botorch_class: Any, json: Dict[str, Any]
  ) -> Type[Any]:
      """Load any instance of `torch.nn.Module` or descendants registered in
      `CLASS_DECODER_REGISTRY` from state dict."""
      state_dict = json.pop("state_dict")
      if issubclass(botorch_class, ChainedInputTransform):
          return botorch_class(
              **{
                  k: botorch_component_from_json(
                      botorch_class=REVERSE_INPUT_TRANSFORM_REGISTRY[
                          v.pop("__type")
                      ],
                      json=v,
                  )
                  for k, v in state_dict.items()
              }
          )
      if issubclass(botorch_class, ChainedOutcomeTransform):
          return botorch_class(
              **{
                  k: botorch_component_from_json(
                      botorch_class=REVERSE_OUTCOME_TRANSFORM_REGISTRY[
                          v.pop("__type")
                      ],
                      json=v,
                  )
                  for k, v in state_dict.items()
              }
          )
      class_path = json.pop("class")
      init_args = inspect.signature(botorch_class).parameters
      required_args = {
          p
          for p, v in init_args.items()
          if v.default is inspect._empty and p != "kwargs"
      }
      allowable_args = set(init_args)
      received_args = set(state_dict)
      missing_args = required_args - received_args
      if missing_args:
          raise ValueError(
              f"Missing required initialization args {missing_args} for class "
              f"{class_path}. For gpytorch objects, this is likely because the "
              "object's `state_dict` method does not return the args required "
              "for initialization."
          )
      extra_args = received_args - allowable_args
      if extra_args:
          raise ValueError(
              f"Received unused args {extra_args} for class {class_path}. "
              "For gpytorch objects, this is likely because the object's "
              "`state_dict` method returns these extra args, which could "
              "indicate that the object's state will not be fully recreated "
              "by this serialization/deserialization method."
          )
      return botorch_class(
          **{
              k: tensor_or_size_from_json(json=v)
              if isinstance(v, dict) and "__type" in v
              else v
              for k, v in state_dict.items()
          }
      )
  
imports: from __future__ import annotations
  import inspect
  import logging
  from datetime import datetime
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Type, TYPE_CHECKING, Union
  import torch
  from ax.core.arm import Arm
  from ax.core.base_trial import TrialStatus
  from ax.core.batch_trial import AbandonedArm, BatchTrial, GeneratorRunStruct
  from ax.core.generator_run import GeneratorRun
  from ax.core.runner import Runner
  from ax.core.trial import Trial
  from ax.exceptions.storage import JSONDecodeError
  from ax.modelbridge.transforms.base import Transform
  from ax.storage.botorch_modular_registry import CLASS_TO_REVERSE_REGISTRY, REVERSE_INPUT_TRANSFORM_REGISTRY, REVERSE_OUTCOME_TRANSFORM_REGISTRY
  from ax.storage.transform_registry import REVERSE_TRANSFORM_REGISTRY
  from ax.utils.common.kwargs import warn_on_kwargs
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast
  from ax.utils.common.typeutils_torch import torch_type_from_str
  from botorch.models.transforms.input import ChainedInputTransform, InputTransform
  from botorch.models.transforms.outcome import ChainedOutcomeTransform, OutcomeTransform
label_desc: Use image node_id 9 for calling a global function with example usage: botorch_component_from_json(botorch_class, json) and returns: botorch_class, botorch_class, botorch_class