code: def __init__(
      self, model_dir, conf_file, type=SamplerType.MetropolisHastings
  ):
      # Read model configuration.
      config = ModelConfig()
      conf_file_path = os.path.join(model_dir, conf_file)
      load_prototxt(conf_file_path, config)
      self.__model = TopicModel(model_dir, config)
      self.__config = config
  
      # Initialize the sampler according to the configuration.
      if type == SamplerType.GibbsSampling:
          self.__sampler = GibbsSampler(self.__model)
      elif type == SamplerType.MetropolisHastings:
          self.__sampler = MHSampler(self.__model)
  
file_path: PaddleHub/modules/text/language_model/slda_news/inference_engine.py
imports: import os
  from paddlehub.common.logger import logger
  from slda_news.config import ModelConfig
  from slda_news.util import load_prototxt, fix_random_seed, rand_k
  from slda_news.model import TopicModel
  from slda_news.sampler import GibbsSampler, MHSampler
  from slda_news.document import LDADoc, SLDADoc, Token, Sentence
  from slda_news.vocab import OOV
label_desc: Use image node_id 1 to create a new InferenceEngine object from inherited base classes: object with example: obj = InferenceEngine(model_dir, conf_file, type)