class_docstr: Back Translation with hugging-face translation models.
  A sentence can only be transformed into one sentence at most.
class_docstr_tok: ["Back","Translation","with","hugging-face","translation","models",".","A","sentence","can","only","be","transformed","into","one","sentence","at","most","."]
code: def _transform(self, sample, n=1, field="x", **kwargs):
      if self.to_model is None:
          self.get_model()
      text = sample.get_text(field)
      # translate
      input_ids = self.from_tokenizer.encode(text, return_tensors="pt")
      input_ids = input_ids.to(self.device)
      outputs = self.from_model.generate(input_ids)
      translated_text = self.from_tokenizer.decode(
          outputs[0], skip_special_tokens=True
      )
      # back_translate
      input_ids = self.to_tokenizer.encode(
          translated_text, return_tensors="pt"
      )
      input_ids = input_ids.to(self.device)
      outputs = self.to_model.generate(input_ids)
      back_translated_text = self.to_tokenizer.decode(
          outputs[0], skip_special_tokens=True
      )
  
      return [sample.replace_field(field, back_translated_text)]
  
file_path: textflint/textflint/generation/transformation/UT/back_trans.py
imports: import torch
  from ..transformation import Transformation
  from ....common import device
  from ....common.settings import TRANS_FROM_MODEL, TRANS_TO_MODEL
label_desc: Use image node_id 5 for calling the BackTrans obj's underlying member method code with example usage: obj._transform(sample, n, field) and returns: list