code: def replace_with_jit():
      """
      Monkey patch some transformer functions to replace with scriptable ones.
      """
      # to revert monkey patch without reload()
      safecopy_modules(
          patch_functions, _get_modules_dict(patch_modules)
      )
  
      BertEmbeddings.forward = BertEmbeddingsJit.forward
      BertEncoder.forward = BertEncoderJit.forward
      BertLayer.forward = BertLayerJit.forward
      BertAttention.forward = BertAttentionJit.forward
      BertSelfAttention.forward = BertSelfAttentionJit.forward
      BertSelfAttention.transpose_for_scores = (
          BertSelfAttentionJit.transpose_for_scores
      )
      BertModel.forward = BertModelJit.forward
      PreTrainedModel.__jit_unused_properties__ = [
          "base_model",
          "dummy_inputs",
          "device",
          "dtype",
      ]
      RobertaEmbeddings.forward = RobertaEmbeddingsJit.forward
      RobertaEncoder.forward = BertEncoderJit.forward
      RobertaLayer.forward = BertLayerJit.forward
      RobertaAttention.forward = BertAttentionJit.forward
      RobertaSelfAttention.forward = BertSelfAttentionJit.forward
      RobertaSelfAttention.transpose_for_scores = (
          BertSelfAttentionJit.transpose_for_scores
      )
      RobertaModel.forward = BertModelJit.forward
  
imports: import math
  from typing import List, Optional, Tuple
  import torch
  from mmf.utils.patch import restore_saved_modules, safecopy_modules
  from torch import nn, Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: replace_with_jit() without return types