code: def main(args):
      logging.info("Generating data")
      pyro.set_rng_seed(0)
      pyro.clear_param_store()
  
      # We can generate synthetic data directly by calling the model.
      true_topic_weights, true_topic_words, data = model(args=args)
  
      # We'll train using SVI.
      logging.info("-" * 40)
      logging.info("Training on {} documents".format(args.num_docs))
      predictor = make_predictor(args)
      guide = functools.partial(parametrized_guide, predictor)
      Elbo = JitTraceEnum_ELBO if args.jit else TraceEnum_ELBO
      elbo = Elbo(max_plate_nesting=2)
      optim = ClippedAdam({"lr": args.learning_rate})
      svi = SVI(model, guide, optim, elbo)
      logging.info("Step\tLoss")
      for step in range(args.num_steps):
          loss = svi.step(data, args=args, batch_size=args.batch_size)
          if step % 10 == 0:
              logging.info("{: >5d}\t{}".format(step, loss))
      loss = elbo.loss(model, guide, data, args=args)
      logging.info("final loss = {}".format(loss))
  
file_path: pyro/examples/lda.py
imports: import argparse
  import functools
  import logging
  import torch
  from torch import nn
  from torch.distributions import constraints
  import pyro
  import pyro.distributions
  from pyro.infer import SVI, JitTraceEnum_ELBO, TraceEnum_ELBO
  from pyro.optim import ClippedAdam
label_desc: Use image node_id 4 for calling a global function with example usage: main(args) without return types