code: def get_callback(use_vision: bool, use_text: bool) -> Callable:
      def callback(states: tensor_dict_type) -> tensor_dict_type:
          if not use_vision:
              for key in list(states.keys()):
                  if key.startswith("vit"):
                      states.pop(key)
          if not use_text:
              for key in list(states.keys()):
                  if (
                      key.startswith("token_embedding")
                      or key.startswith("text_transformer")
                      or key.startswith("text_projection")
                  ):
                      states.pop(key)
          return states
  
      return callback
  
file_path: carefree-learn/cflearn/zoo/models/clip.py
imports: from typing import Any
  from typing import Dict
  from typing import Callable
  from cftool.types import tensor_dict_type
  from .schema import IDLZooModelLoader
label_desc: Use image node_id 1 for calling a global function with example usage: get_callback(use_vision, use_text) and returns: callback, states