code: def infer_svi(args, model):
      losses = model.fit_svi(
          heuristic_num_particles=args.smc_particles,
          heuristic_ess_threshold=args.ess_threshold,
          num_samples=args.num_samples,
          num_steps=args.svi_steps,
          num_particles=args.svi_particles,
          haar=args.haar,
          jit=args.jit,
      )
  
      if args.plot:
          import matplotlib.pyplot as plt
  
          plt.figure(figsize=(6, 3))
          plt.plot(losses)
          plt.xlabel("SVI step")
          plt.ylabel("loss")
          plt.title("SVI Convergence")
          plt.tight_layout()
  
file_path: pyro/examples/contrib/epidemiology/regional.py
imports: import argparse
  import logging
  import torch
  import pyro
  from pyro.contrib.epidemiology.models import RegionalSIRModel
label_desc: Use image node_id 4 for calling a global function with example usage: infer_svi(args, model) without return types