class_docstr: Translator: basic wrapper around MarianMT model for language translation
class_docstr_tok: ["Translator",":","basic","wrapper","around","MarianMT","model","for","language","translation"]
docstr: ```
  basic wrapper around MarianMT model for language translation
  
  Args:
    model_name(str): Helsinki-NLP model
    device(str): device to use (e.g., 'cuda', 'cpu')
    quantize(bool): If True, use quantization.
  ```
docstr_tok: ["``","`","basic","wrapper","around","MarianMT","model","for","language","translation","Args",":","model_name","(","str",")",":","Helsinki-NLP","model","device","(","str",")",":","device","to","use","(","e.g.",",","'cuda","'",",","'cpu","'",")","quantize","(","bool",")",":","If","True",",","use","quantization",".","``","`"]
code: def __init__(self, model_name=None, device=None, quantize=False):
      """
      ```
      basic wrapper around MarianMT model for language translation
  
      Args:
        model_name(str): Helsinki-NLP model
        device(str): device to use (e.g., 'cuda', 'cpu')
        quantize(bool): If True, use quantization.
      ```
      """
      if "Helsinki-NLP" not in model_name:
          warnings.warn(
              "Translator requires a Helsinki-NLP model: https://huggingface.co/Helsinki-NLP"
          )
      super().__init__(device=device, quantize=quantize)
      from transformers import MarianMTModel, MarianTokenizer
  
      self.tokenizer = MarianTokenizer.from_pretrained(model_name)
      self.model = MarianMTModel.from_pretrained(model_name).to(
          self.torch_device
      )
      if quantize:
          self.model = self.quantize_model(self.model)
  
file_path: ktrain/ktrain/text/translation/core.py
imports: from ...None import utils
  from ...imports import *
  from ...torch_base import TorchBase
  from ..None import textutils
label_desc: Use image node_id 1 to create a new Translator object from inherited base classes: TorchBase with example: obj = Translator(model_name, device, quantize)