docstr: Generates candidates from the fitted model, using the model gen
  kwargs set on the model spec, alongside any passed as kwargs
  to this function (local kwargs take precedent)
  
  NOTE: Model must have been fit prior to calling gen()
  
  Args:
      n: Integer representing how many arms should be in the generator run
          produced by this method. NOTE: Some underlying models may ignore
          the ``n`` and produce a model-determined number of arms. In that
          case this method will also output a generator run with number of
          arms that can differ from ``n``.
      pending_observations: A map from metric name to pending
          observations for that metric, used by some models to avoid
          resuggesting points that are currently being evaluated.
docstr_tok: ["Generates","candidates","from","the","fitted","model",",","using","the","model","gen","kwargs","set","on","the","model","spec",",","alongside","any","passed","as","kwargs","to","this","function","(","local","kwargs","take","precedent",")","NOTE",":","Model","must","have","been","fit","prior","to","calling","gen","(",")","Args",":","n",":","Integer","representing","how","many","arms","should","be","in","the","generator","run","produced","by","this","method",".","NOTE",":","Some","underlying","models","may","ignore","the","``","n","``","and","produce","a","model-determined","number","of","arms",".","In","that","case","this","method","will","also","output","a","generator","run","with","number","of","arms","that","can","differ","from","``","n","``",".","pending_observations",":","A","map","from","metric","name","to","pending","observations","for","that","metric",",","used","by","some","models","to","avoid","resuggesting","points","that","are","currently","being","evaluated","."]
code: def gen(self, **model_gen_kwargs: Any) -> GeneratorRun:
      """Generates candidates from the fitted model, using the model gen
      kwargs set on the model spec, alongside any passed as kwargs
      to this function (local kwargs take precedent)
  
      NOTE: Model must have been fit prior to calling gen()
  
      Args:
          n: Integer representing how many arms should be in the generator run
              produced by this method. NOTE: Some underlying models may ignore
              the ``n`` and produce a model-determined number of arms. In that
              case this method will also output a generator run with number of
              arms that can differ from ``n``.
          pending_observations: A map from metric name to pending
              observations for that metric, used by some models to avoid
              resuggesting points that are currently being evaluated.
      """
      fitted_model = self.fitted_model
      model_gen_kwargs = consolidate_kwargs(
          kwargs_iterable=[
              self.model_gen_kwargs,
              model_gen_kwargs,
          ],
          keywords=get_function_argument_names(fitted_model.gen),
      )
      return fitted_model.gen(**model_gen_kwargs)
  
imports: from __future__ import annotations
  import json
  import warnings
  from copy import deepcopy
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Optional, Tuple
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.search_space import SearchSpace
  from ax.exceptions.core import UserInputError
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.cross_validation import compute_diagnostics, cross_validate, CVDiagnostics, CVResult
  from ax.modelbridge.registry import ModelRegistryBase
  from ax.utils.common.base import SortableBase
  from ax.utils.common.kwargs import consolidate_kwargs, filter_kwargs, get_function_argument_names
  from ax.utils.common.serialization import SerializationMixin
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 10 for calling the ModelSpec obj's underlying member method code with example usage: obj.gen() and returns: fitted_model