class_docstr: Attribution class for large language models. It wraps a gradient-based
  attribution algorthm to produce commonly interested attribution
  results for the use case of text generation.
  The wrapped instance will calculate attribution in the
  same way as configured in the original attribution algorthm,
  with respect to the log probabilities of each
  generated token and the whole sequence. It will provide a
  new "attribute" function which accepts text-based inputs
  and returns LLMAttributionResult
class_docstr_tok: ["Attribution","class","for","large","language","models",".","It","wraps","a","gradient-based","attribution","algorthm","to","produce","commonly","interested","attribution","results","for","the","use","case","of","text","generation",".","The","wrapped","instance","will","calculate","attribution","in","the","same","way","as","configured","in","the","original","attribution","algorthm",",","with","respect","to","the","log","probabilities","of","each","generated","token","and","the","whole","sequence",".","It","will","provide","a","new","``","attribute","''","function","which","accepts","text-based","inputs","and","returns","LLMAttributionResult"]
docstr: Convert str to tokenized tensor
docstr_tok: ["Convert","str","to","tokenized","tensor"]
code: def _format_model_input(self, model_input):
      """
      Convert str to tokenized tensor
      """
      return model_input.to(self.device)
  
imports: from copy import copy
  from typing import Callable, cast, Dict, List, Optional, Union
  import matplotlib.pyplot
  import numpy
  import torch
  from captum.attr._core.feature_ablation import FeatureAblation
  from captum.attr._core.kernel_shap import KernelShap
  from captum.attr._core.layer.layer_integrated_gradients import LayerIntegratedGradients
  from captum.attr._core.lime import Lime
  from captum.attr._core.shapley_value import ShapleyValues, ShapleyValueSampling
  from captum.attr._utils.attribution import Attribution
  from captum.attr._utils.interpretable_input import InterpretableInput, TextTemplateInput, TextTokenInput
  from torch import nn, Tensor
label_desc: Use image node_id 3 for calling the LLMGradientAttribution obj's underlying member method code with example usage: obj._format_model_input(model_input) and returns: model_input