code: def save_checkpoint(strategy, fname, exclude=None):
      """Save the strategy state into a file.
  
      The file can be loaded using `maybe_load_checkpoint`.
  
      For efficiency, the user can specify some attributes to `exclude`.
      For example, if the optimizer is static and doesn't change during training,
      it can be safely excluded. These helps to speed up the serialization.
  
      WARNING: the method cannot be used inside the training and evaluation
      loops of the strategy.
  
      :param strategy: strategy to serialize.
      :param fname: name of the file.
      :param exclude: List[string] list of attributes to remove before the
          serialization.
      :return:
      """
      if exclude is None:
          exclude = []
      ended_experience_counter = strategy.clock.train_exp_counter
  
      strategy = copy(strategy)
      for attr in exclude:
          delattr(strategy, attr)
  
      checkpoint_data = {
          "strategy": strategy,
          "rng_manager": RNGManager,
          "exp_counter": ended_experience_counter,
      }
      torch.save(checkpoint_data, fname, pickle_module=dill)
  
imports: import os.path
  from copy import copy
  import dill
  import torch
  from avalanche.training.determinism.rng_manager import RNGManager
label_desc: Use image node_id 2 for calling a global function with example usage: save_checkpoint(strategy, fname, exclude) without return types