class_docstr: Base class for LLM models
  
  This class handles a few of the checks, as well as the whole prediction
  machinery.
  
  Required attributes are:
  
  - model_name
  - model
  - tokenizer
  - prompt
  - probas_sum_to_1
  - device
  - error_low_prob
  - threshold_low_prob
  - use_caching
class_docstr_tok: ["Base","class","for","LLM","models","This","class","handles","a","few","of","the","checks",",","as","well","as","the","whole","prediction","machinery",".","Required","attributes","are",":","-","model_name","-","model","-","tokenizer","-","prompt","-","probas_sum_to_1","-","device","-","error_low_prob","-","threshold_low_prob","-","use_caching"]
docstr: Prepare everything to enable predictions.
docstr_tok: ["Prepare","everything","to","enable","predictions","."]
code: def _fit(self, X, y, **fit_params):
      """Prepare everything to enable predictions."""
      self.check_args()
      self.check_X_y(X, y)
      if self.model_name is not None:
          self.model_, self.tokenizer_ = _load_model_and_tokenizer(
              self.model_name, device=self.device
          )
      else:
          self.model_, self.tokenizer_ = self.model, self.tokenizer
  
      if self._is_encoder_decoder(self.model_) and self.use_caching:
          # Explanation: When we have a prompt [1, 2, 3] and label [4, 5], and
          # if the model is an encoder-decoder architecture (seq2seq), then
          # [1, 2, 3] is encoded and [4, 5] are generated by the decoder. If
          # we wanted to cache, we would store the result (among others) for
          # [1, 2, 3, 4]. However, encoding [1, 2, 3, 4] and generating [5] is
          # not the same operation as encoding [1, 2, 3] and generating [4,
          # 5]. Granted, the logits could be very close, but we cannot be sure
          # and it will depend on the model. Therefore, for the time being, we
          # don't allow caching for encoder-decoder models.
          raise ValueError(
              "Caching is not supported for encoder-decoder models, "
              "initialize the model with use_caching=False."
          )
  
      self.classes_ = self.check_classes(y)
      self.prompt_ = self.check_prompt(self.prompt)
      classes = [str(c) for c in self.classes_]
      self.label_ids_ = self.tokenizer_(classes)["input_ids"]
      self.cached_model_ = _CacheModelWrapper(
          self.model_, self.tokenizer_, use_caching=self.use_caching
      )
      return self
  
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 10 for calling the _LlmBase obj's underlying member method code with example usage: obj._fit(X, y) and returns: self