code: def copy_params_dict(
      model, copy_grad=False
  ) -> Dict[str, "ParamData"]:
      """
      Create a list of (name, parameter), where parameter is copied from model.
      The list has as many parameters as model, with the same size.
  
      :param model: a pytorch model
      :param copy_grad: if True returns gradients instead of parameter values
      """
      out: Dict[str, ParamData] = {}
      for k, p in model.named_parameters():
          if copy_grad and p.grad is None:
              continue
          init = p.grad.data.clone() if copy_grad else p.data.clone()
          out[k] = ParamData(
              k, p.shape, device=p.device, init_tensor=init
          )
      return out
  
imports: from collections import defaultdict
  from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn import Linear, Module
  from torch.utils.data import DataLoader, Dataset
  from avalanche.benchmarks import OnlineCLExperience
  from avalanche.models.batch_renorm import BatchRenorm2D
label_desc: Use image node_id 6 for calling a global function with example usage: copy_params_dict(model, copy_grad) and returns: out