code: def main(args):
      # --- CONFIG
      device = torch.device(
          f"cuda:{args.cuda}"
          if torch.cuda.is_available() and args.cuda >= 0
          else "cpu"
      )
  
      # --- BENCHMARK CREATION
      benchmark = SplitMNIST(n_experiences=10, seed=1234)
      # ---------
  
      # MODEL CREATION
      model = SimpleMLP(num_classes=benchmark.n_classes)
  
      # choose some metrics and evaluation method
      interactive_logger = InteractiveLogger()
  
      eval_plugin = EvaluationPlugin(
          accuracy_metrics(
              minibatch=True, epoch=True, experience=True, stream=True
          ),
          loss_metrics(
              minibatch=True, epoch=True, experience=True, stream=True
          ),
          forgetting_metrics(experience=True),
          loggers=[interactive_logger],
      )
  
      # CREATE THE STRATEGY INSTANCE (GenerativeReplay)
      cl_strategy = GenerativeReplay(
          model,
          torch.optim.Adam(model.parameters(), lr=0.001),
          CrossEntropyLoss(),
          train_mb_size=100,
          train_epochs=4,
          eval_mb_size=100,
          device=device,
          evaluator=eval_plugin,
      )
  
      # TRAINING LOOP
      print("Starting experiment...")
      results = []
      for experience in benchmark.train_stream:
          print("Start of experience ", experience.current_experience)
          cl_strategy.train(experience)
          print("Training completed")
  
          print("Computing accuracy on the whole test set")
          results.append(cl_strategy.eval(benchmark.test_stream))
  
file_path: avalanche/examples/generative_replay_splitMNIST.py
imports: import argparse
  import torch
  from torch.nn import CrossEntropyLoss
  from torchvision import transforms
  from torchvision.transforms import ToTensor, RandomCrop
  import torch.optim.lr_scheduler
  from avalanche.benchmarks import SplitMNIST
  from avalanche.models import SimpleMLP
  from avalanche.training.supervised import GenerativeReplay
  from avalanche.evaluation.metrics import forgetting_metrics, accuracy_metrics, loss_metrics
  from avalanche.logging import InteractiveLogger
  from avalanche.training.plugins import EvaluationPlugin
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types