class_docstr: interface to Image Captioner
class_docstr_tok: ["interface","to","Image","Captioner"]
docstr: ```
  ImageCaptioner constructor
  
  Args:
    model_name(str): name of  image captioning model
    device(str): device to use (e.g., 'cuda', 'cpu')
  ```
docstr_tok: ["``","`","ImageCaptioner","constructor","Args",":","model_name","(","str",")",":","name","of","image","captioning","model","device","(","str",")",":","device","to","use","(","e.g.",",","'cuda","'",",","'cpu","'",")","``","`"]
code: def __init__(
      self, model_name="ydshieh/vit-gpt2-coco-en", device=None
  ):
      """
      ```
      ImageCaptioner constructor
  
      Args:
        model_name(str): name of  image captioning model
        device(str): device to use (e.g., 'cuda', 'cpu')
      ```
      """
      if not I.PIL_INSTALLED:
          raise Exception(
              "PIL is not installed. Please install with: pip install pillow>=9.0.1"
          )
  
      super().__init__(
          device=device,
          quantize=False,
          min_transformers_version="4.12.3",
      )
      self.model_name = model_name
      from transformers import (
          AutoTokenizer,
          VisionEncoderDecoderModel,
          ViTFeatureExtractor,
      )
  
      self.model = VisionEncoderDecoderModel.from_pretrained(
          self.model_name
      ).to(self.torch_device)
      self.tokenizer = AutoTokenizer.from_pretrained(self.model_name)
      self.extractor = ViTFeatureExtractor.from_pretrained(
          self.model_name
      )
  
imports: from ...None import imports
  from ...torch_base import TorchBase
label_desc: Use image node_id 1 to create a new ImageCaptioner object from inherited base classes: TorchBase with example: obj = ImageCaptioner(model_name, device)