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: Return the classes predicted by the LLM.
  
  Predictions will be forced to be one of the labels the model learned
  during ``fit`` (see the ``classes_`` attribute). The model will never
  predict a different label.
  
  If ``error_low_prob`` is set to ``'warn'``, then a warning is given if,
  for at least one sample, the sum of the probabilities for all classes is
  below the threshold set in ``threshold_low_prob``. If ``error_low_prob``
  is set to ``'raise'``, then an error is raised instead.
  
  If ``error_low_prob`` is set to ``'return_none'``, then the predicted
  class will be replaced by ``None`` if the sum of the probabilities is
  below the threshold set in ``threshold_low_prob``.
  
  Parameters
  ----------
  X : input data
    Typically, this is a list/array of strings. E.g., this could be a list
    of reviews and the target is the sentiment. Technically, however, this
    can also contain numerical or categorical data, although it is
    unlikely that the LLM will generate good predictions for those.
  
  Returns
  -------
  y_pred : numpy ndarray
    The label for each class.
docstr_tok: ["Return","the","classes","predicted","by","the","LLM",".","Predictions","will","be","forced","to","be","one","of","the","labels","the","model","learned","during","``","fit","``","(","see","the","``","classes_","``","attribute",")",".","The","model","will","never","predict","a","different","label",".","If","``","error_low_prob","``","is","set","to","``","'warn","'","``",",","then","a","warning","is","given","if",",","for","at","least","one","sample",",","the","sum","of","the","probabilities","for","all","classes","is","below","the","threshold","set","in","``","threshold_low_prob","``",".","If","``","error_low_prob","``","is","set","to","``","'raise","'","``",",","then","an","error","is","raised","instead",".","If","``","error_low_prob","``","is","set","to","``","'return_none","'","``",",","then","the","predicted","class","will","be","replaced","by","``","None","``","if","the","sum","of","the","probabilities","is","below","the","threshold","set","in","``","threshold_low_prob","``",".","Parameters","--","--","--","--","--","X",":","input","data","Typically",",","this","is","a","list\/array","of","strings",".","E.g.",",","this","could","be","a","list","of","reviews","and","the","target","is","the","sentiment",".","Technically",",","however",",","this","can","also","contain","numerical","or","categorical","data",",","although","it","is","unlikely","that","the","LLM","will","generate","good","predictions","for","those",".","Returns","--","--","--","-","y_pred",":","numpy","ndarray","The","label","for","each","class","."]
code: def predict(self, X):
      """Return the classes predicted by the LLM.
  
      Predictions will be forced to be one of the labels the model learned
      during ``fit`` (see the ``classes_`` attribute). The model will never
      predict a different label.
  
      If ``error_low_prob`` is set to ``'warn'``, then a warning is given if,
      for at least one sample, the sum of the probabilities for all classes is
      below the threshold set in ``threshold_low_prob``. If ``error_low_prob``
      is set to ``'raise'``, then an error is raised instead.
  
      If ``error_low_prob`` is set to ``'return_none'``, then the predicted
      class will be replaced by ``None`` if the sum of the probabilities is
      below the threshold set in ``threshold_low_prob``.
  
      Parameters
      ----------
      X : input data
        Typically, this is a list/array of strings. E.g., this could be a list
        of reviews and the target is the sentiment. Technically, however, this
        can also contain numerical or categorical data, although it is
        unlikely that the LLM will generate good predictions for those.
  
      Returns
      -------
      y_pred : numpy ndarray
        The label for each class.
  
      """
      # y_proba not normalized but it's not neeeded here
      y_proba = self._predict_proba(X)
      pred_ids = y_proba.argmax(1)
      y_pred = self.classes_[pred_ids]
  
      if self.error_low_prob == "return_none":
          y_pred = y_pred.astype(
              object
          )  # prevents None from being cast to str
          mask_low_probas = y_proba.sum(1) < self.threshold_low_prob
          y_pred[mask_low_probas] = None
      return y_pred
  
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 14 for calling the _LlmBase obj's underlying member method code with example usage: obj.predict(X) and returns: y_pred