class_docstr: Construct an MBART tokenizer.
  
  Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on
  [SentencePiece](https://github.com/google/sentencepiece).
  
  The tokenization method is `<tokens> <eos> <language code>` for source language documents, and `<language code>
  <tokens> <eos>` for target language documents.
  
  Examples:
  
  ```python
  >>> from transformers import MBartTokenizer
  
  >>> tokenizer = MBartTokenizer.from_pretrained("facebook/mbart-large-en-ro", src_lang="en_XX", tgt_lang="ro_RO")
  >>> example_english_phrase = " UN Chief Says There Is No Military Solution in Syria"
  >>> expected_translation_romanian = "Şeful ONU declară că nu există o soluţie militară în Siria"
  >>> inputs = tokenizer(example_english_phrase, text_target=expected_translation_romanian, return_tensors="pt")
  ```
docstr: Used by translation pipeline, to prepare inputs for the generate function
docstr_tok: ["Used","by","translation","pipeline",",","to","prepare","inputs","for","the","generate","function"]
code: def _build_translation_inputs(
      self,
      raw_inputs,
      return_tensors: str,
      src_lang: Optional[str],
      tgt_lang: Optional[str],
      **extra_kwargs,
  ):
      """Used by translation pipeline, to prepare inputs for the generate function"""
      if src_lang is None or tgt_lang is None:
          raise ValueError(
              "Translation requires a `src_lang` and a `tgt_lang` for this model"
          )
      self.src_lang = src_lang
      inputs = self(
          raw_inputs,
          add_special_tokens=True,
          return_tensors=return_tensors,
          **extra_kwargs,
      )
      tgt_lang_id = self.convert_tokens_to_ids(tgt_lang)
      inputs["forced_bos_token_id"] = tgt_lang_id
      return inputs
  
imports: import os
  from shutil import copyfile
  from typing import Any, Dict, List, Optional, Tuple
  import sentencepiece
  from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer
  from ...utils import logging
label_desc: Use image node_id 10 for calling the MBartTokenizer obj's underlying member method code with example usage: obj._build_translation_inputs(raw_inputs, return_tensors, src_lang, tgt_lang) and returns: inputs