docstr: Determine whether to use the realtime inference based on the sample number
  and the data modalities. Loading image data requires more time than text.
  Thus, we set a small threshold for image data. We may also consider the
  model size in future, but we need to ensure this function is efficient since
  using this function also costs additional inference time.
  
  Parameters
  ----------
  realtime
      The provided realtime flag.
  data
      A dataframe.
  data_processors
      A dict of data processors.
  batch_size
      The batch size from config.
  
  Returns
  -------
  Whether to use the realtime inference.
docstr_tok: ["Determine","whether","to","use","the","realtime","inference","based","on","the","sample","number","and","the","data","modalities",".","Loading","image","data","requires","more","time","than","text",".","Thus",",","we","set","a","small","threshold","for","image","data",".","We","may","also","consider","the","model","size","in","future",",","but","we","need","to","ensure","this","function","is","efficient","since","using","this","function","also","costs","additional","inference","time",".","Parameters","--","--","--","--","--","realtime","The","provided","realtime","flag",".","data","A","dataframe",".","data_processors","A","dict","of","data","processors",".","batch_size","The","batch","size","from","config",".","Returns","--","--","--","-","Whether","to","use","the","realtime","inference","."]
code: def use_realtime(
      self,
      realtime: bool,
      data: pd.DataFrame,
      data_processors: Union[Dict, List[Dict]],
      batch_size: int,
  ):
      """
      Determine whether to use the realtime inference based on the sample number
      and the data modalities. Loading image data requires more time than text.
      Thus, we set a small threshold for image data. We may also consider the
      model size in future, but we need to ensure this function is efficient since
      using this function also costs additional inference time.
  
      Parameters
      ----------
      realtime
          The provided realtime flag.
      data
          A dataframe.
      data_processors
          A dict of data processors.
      batch_size
          The batch size from config.
  
      Returns
      -------
      Whether to use the realtime inference.
      """
      if realtime is not None:
          return realtime
  
      realtime = False
      sample_num = len(data)
      if (
          IMAGE in data_processors and len(data_processors[IMAGE]) > 0
      ):  # has image
          if sample_num <= min(10, batch_size):
              realtime = True
      elif (
          TEXT in data_processors and len(data_processors[TEXT]) > 0
      ):  # has text but no image
          if sample_num <= min(100, batch_size):
              realtime = True
      else:  # only has tabular data
          if sample_num <= min(200, batch_size):
              realtime = True
  
      return realtime
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/inference.py
imports: import logging
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import pandas
  import torch
  from omegaconf import OmegaConf
  from scipy.special import softmax
  from torch import nn
  from ..constants import BBOX, COLUMN_FEATURES, FEATURES, IMAGE, IMAGE_META, LOGITS, MASKS, NER_ANNOTATION, NER_RET, OVD_RET, PROBABILITY, PROMPT, QUERY, RESPONSE, SCORE, SEMANTIC_MASK, TEXT, TOKEN_WORD_MAPPING, WORD_OFFSETS
  from ..data.preprocess_dataframe import MultiModalFeaturePreprocessor
  from ..data.utils import apply_data_processor, apply_df_preprocessor, get_collate_fn, get_per_sample_features
  from ..models.utils import run_model
  from .environment import get_precision_context, move_to_device
  from .matcher import compute_matching_probability
  from .misc import tensor_to_ndarray
label_desc: Use image node_id 3 for calling the RealtimeMixin obj's underlying member method code with example usage: obj.use_realtime(realtime, data, data_processors, batch_size) and returns: realtime, realtime