code: def eval_decorator(fn):
      def inner(model, *args, **kwargs):
          was_training = model.training
          model.eval()
          out = fn(model, *args, **kwargs)
          model.train(was_training)
          return out
  
      return inner
  
file_path: colossalai/examples/language/palm/palm_pytorch/autoregressive_wrapper.py
imports: import torch
  import torch.nn.functional
  from einops import rearrange
  from torch import nn
label_desc: Use image node_id 2 for calling a global function with example usage: eval_decorator(fn) and returns: inner, out