class_docstr: interface to Transformer-based text summarization
docstr: ```
  interface to BART-based text summarization using transformers library
  
  Args:
    model_name(str): name of BART model for summarization
    device(str): device to use (e.g., 'cuda', 'cpu')
  ```
docstr_tok: ["``","`","interface","to","BART-based","text","summarization","using","transformers","library","Args",":","model_name","(","str",")",":","name","of","BART","model","for","summarization","device","(","str",")",":","device","to","use","(","e.g.",",","'cuda","'",",","'cpu","'",")","``","`"]
code: def __init__(self, model_name="facebook/bart-large-cnn", device=None):
      """
      ```
      interface to BART-based text summarization using transformers library
  
      Args:
        model_name(str): name of BART model for summarization
        device(str): device to use (e.g., 'cuda', 'cpu')
      ```
      """
      if "bart" not in model_name:
          raise ValueError(
              "TransformerSummarizer currently only accepts BART models"
          )
      super().__init__(device=device)
      from transformers import (
          BartForConditionalGeneration,
          BartTokenizer,
      )
  
      self.tokenizer = BartTokenizer.from_pretrained(model_name)
      self.model = BartForConditionalGeneration.from_pretrained(
          model_name
      ).to(self.torch_device)
  
file_path: ktrain/ktrain/text/summarization/core.py
imports: from ...torch_base import TorchBase
label_desc: Use image node_id 1 to create a new TransformerSummarizer object from inherited base classes: TorchBase with example: obj = TransformerSummarizer(model_name, device)