code: def main(args):
      from nnest import NestedSampler
      from nnest.distributions import GeneralisedNormal
      from nnest.likelihoods import (
          Himmelblau,
          Rosenbrock,
          Gaussian,
          Eggbox,
          GaussianShell,
          GaussianMix,
      )
  
      if args.base_dist == "gen_normal":
          base_dist = GeneralisedNormal(
              torch.zeros(args.x_dim),
              torch.ones(args.x_dim),
              torch.tensor(args.beta),
          )
      else:
          base_dist = None
  
      if args.likelihood.lower() == "himmelblau":
          like = Himmelblau(args.x_dim)
          transform = lambda x: 5 * x
      elif args.likelihood.lower() == "rosenbrock":
          like = Rosenbrock(args.x_dim)
          transform = lambda x: 5 * x
      elif args.likelihood.lower() == "gaussian":
          like = Gaussian(args.x_dim, args.corr, lim=3)
          transform = lambda x: 3 * x
      elif args.likelihood.lower() == "eggbox":
          like = Eggbox(args.x_dim)
          transform = lambda x: x * 5 * np.pi
      elif args.likelihood.lower() == "shell":
          like = GaussianShell(args.x_dim)
          transform = lambda x: 5 * x
      elif args.likelihood.lower() == "mixture":
          like = GaussianMix(args.x_dim)
          transform = lambda x: 10 * x
      else:
          raise ValueError("Likelihood not found")
  
      log_dir = os.path.join(args.log_dir, args.likelihood)
      log_dir += args.log_suffix
  
      sampler = NestedSampler(
          like.x_dim,
          like,
          transform=transform,
          log_dir=log_dir,
          num_live_points=args.num_live_points,
          hidden_dim=args.hidden_dim,
          num_layers=args.num_layers,
          num_blocks=args.num_blocks,
          num_slow=args.num_slow,
          use_gpu=args.use_gpu,
          base_dist=base_dist,
          scale=args.scale,
          flow=args.flow,
      )
      start_time = time.time()
      sampler.run(
          train_iters=args.train_iters,
          mcmc_steps=args.mcmc_steps,
          volume_switch=args.switch,
          jitter=args.jitter,
          mcmc_num_chains=args.mcmc_num_chains,
          mcmc_dynamic_step_size=not args.mcmc_fixed_step_size,
      )
      end_time = time.time()
      print(
          "Run time %s"
          % datetime.timedelta(seconds=end_time - start_time)
      )
  
file_path: nnest/examples/nested/run.py
imports: import os
  import sys
  import argparse
  import time
  import datetime
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types