code: def _validate_model_args(
      args: Union[
          _ServableType,
          List[_ServableType],
          Tuple[_ServableType, ...],
          Dict[str, _ServableType],
      ]
  ) -> None:
      """Validator for machine learning models.
  
      Parameters
      ----------
      args
          model args passed into ``__init__`` of ``ModelComponent``
  
      Raises
      ------
      ValueError
          If an empty iterable is passed as the model argument
      TypeError
          If the args do not contain properly formatted model refences
  
      """
      if isiterable(args) and len(args) == 0:
          raise ValueError(
              f"Iterable args={args} must have length >= 1"
          )
  
      if isinstance(args, (list, tuple)):
          if not all(isinstance(x, _Servable_t) for x in args):
              raise TypeError(
                  f"One of arg in args={args} is not type {_Servable_t}"
              )
      elif isinstance(args, dict):
          if not all(isinstance(x, str) for x in args):
              raise TypeError(
                  f"One of keys in args={args.keys()} is not type {str}"
              )
          if not all(isinstance(x, _Servable_t) for x in args.values()):
              raise TypeError(
                  f"One of values in args={args} is not type {_Servable_t}"
              )
      elif not isinstance(args, _Servable_t):
          raise TypeError(
              f"Args must be instance, list/tuple, or mapping of {_Servable_t}"
          )
  
file_path: lightning-flash/src/flash/core/serve/component.py
imports: import inspect
  from dataclasses import replace
  from functools import wraps
  from typing import Dict, List, Optional, Tuple, Type, Union
  from torch import nn
  from flash.core.serve.core import ParameterContainer, Servable
  from flash.core.serve.decorators import BoundMeta, UnboundMeta
  from flash.core.utilities.imports import _CYTOOLZ_AVAILABLE, _TOPIC_SERVE_AVAILABLE, requires
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_model_args(args) without return types