class_docstr: The ServableModuleValidator validates to validate a model correctly implement the ServableModule API.
  
  .. warning::  This is an :ref:`experimental <versioning:Experimental API>` feature.
  
  Arguments:
      optimization: The format in which the model should be tested while being served.
      server: The library used to evaluate the model serving. The default is FastAPI.
      host: The host address associated with the server.
      port: The port associated with the server.
      timeout: Timeout period in seconds, that the process should wait for the server to start.
      exit_on_failure: Whether to exit the process on failure.
code: def __init__(
      self,
      optimization: Optional[
          Literal["trace", "script", "onnx", "tensorrt"]
      ] = None,
      server: Literal[
          "fastapi", "ml_server", "torchserve", "sagemaker"
      ] = "fastapi",
      host: str = "127.0.0.1",
      port: int = 8080,
      timeout: int = 20,
      exit_on_failure: bool = True,
  ):
      super().__init__()
      fastapi_installed = RequirementCache("fastapi")
      if not fastapi_installed:
          raise ModuleNotFoundError(fastapi_installed.message)
      uvicorn_installed = RequirementCache("uvicorn")
      if not uvicorn_installed:
          raise ModuleNotFoundError(uvicorn_installed.message)
  
      # TODO: Add support for the other options
      if optimization is not None:
          raise NotImplementedError(
              f"The optimization {optimization} is currently not supported."
          )
      # TODO: Add support for testing with those server services
      if server != "fastapi":
          raise NotImplementedError(
              "Only the fastapi server is currently supported."
          )
  
      self.optimization = optimization
      self.host = host
      self.port = port
      self.server = server
      self.timeout = timeout
      self.exit_on_failure = exit_on_failure
      self.resp: Optional[requests.Response] = None
  
imports: import contextlib
  import logging
  import time
  from multiprocessing import Process
  from typing import Any, Dict, Literal, Optional
  import requests
  import torch
  from lightning_utilities.core.imports import RequirementCache
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch.callbacks import Callback
  from lightning.pytorch.serve.servable_module import ServableModule
  from lightning.pytorch.strategies import DeepSpeedStrategy, FSDPStrategy
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import rank_zero_only
label_desc: Use image node_id 1 to create a new ServableModuleValidator object from inherited base classes: Callback with example: obj = ServableModuleValidator(optimization, server, host, port, timeout, exit_on_failure)