class_docstr: Version of parlai.utils.bpe.Gpt2BpeHelper that can be TorchScripted.
class_docstr_tok: ["Version","of","parlai.utils.bpe.Gpt2BpeHelper","that","can","be","TorchScripted","."]
code: def __init__(
      self,
      add_prefix_space: bool,
      encoder: Dict[str, str],
      byte_encoder: Dict[int, str],
      fused_key_bpe_ranks: Dict[str, float],
      special_tokens: List[str],
  ):
      self.add_prefix_space = add_prefix_space
  
      self.encoder = encoder
      self.decoder: Dict[str, str] = {}
      if self.encoder is not None:
          for k, v in self.encoder.items():
              self.decoder[v] = k
  
      self.byte_encoder = byte_encoder
      self.byte_decoder: Dict[str, int] = {}
      if self.byte_encoder is not None:
          for k, v in self.byte_encoder.items():
              self.byte_decoder[v] = k
  
      self.bpe_ranks = fused_key_bpe_ranks
  
      # special tokens
      self._special_tokens: Dict[str, int] = {}
      for st in special_tokens:
          self._special_tokens[st] = 1
  
imports: from typing import Dict, List, Tuple
  import torch.jit
label_desc: Use image node_id 2 to create a new ScriptableGpt2BpeHelper object from inherited base classes: object with example: obj = ScriptableGpt2BpeHelper(add_prefix_space, encoder, byte_encoder, fused_key_bpe_ranks, special_tokens)