class_docstr: Helper class that caches model generations
  
  For label ids, if one token sequence is [1, 2, 3] and the next token
  sequence is [1, 2, 4], for the 2nd sequence, the generation will retrieve
  the cached logits for [1, 2] and only generate [4].
  
  Set use_caching=False to disable it, e.g. for debugging.
class_docstr_tok: ["Helper","class","that","caches","model","generations","For","label","ids",",","if","one","token","sequence","is","[","1",",","2",",","3","]","and","the","next","token","sequence","is","[","1",",","2",",","4","]",",","for","the","2nd","sequence",",","the","generation","will","retrieve","the","cached","logits","for","[","1",",","2","]","and","only","generate","[","4","]",".","Set","use_caching=False","to","disable","it",",","e.g",".","for","debugging","."]
code: def __init__(self, model, tokenizer, use_caching=True):
      self.model = model
      self.tokenizer = tokenizer
      self.use_caching = use_caching
      self.cache = {}
      self._total_calls = 0
      self._uncached_calls = 0
  
imports: import importlib
  import warnings
  from string import Formatter
  import numpy
  import torch
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
  from transformers import AutoConfig, AutoTokenizer, LogitsProcessor
  from skorch.exceptions import LowProbabilityError
  from skorch.llm.prompts import DEFAULT_PROMPT_FEW_SHOT, DEFAULT_PROMPT_ZERO_SHOT, DELIM
label_desc: Use image node_id 1 to create a new _CacheModelWrapper object  with example: obj = _CacheModelWrapper(model, tokenizer, use_caching)