parameters: (self, path)
docstring: :Description: loads models of already constructed hierarchy
  
          :param str path: a path where hierarchy was saved by hARTM.save method
  
          :Notes:
            * Loaded models will overwrite ARTM.topic_names and class_ids fields of each level.
            * All class_ids weights will be set to 1.0, you need to specify them by\
              hand if it's necessary.
            * The method call will empty ARTM.score_tracker of each level.
            * All regularizers and scores will be forgotten.
            * etc.
            * We strongly recommend you to reset all important parameters of the ARTM\
              models and hARTM, used earlier.
docstring_summary: :Description: loads models of already constructed hierarchy
docstring_tokens: : Description : loads models of already constructed hierarchy
function: def load(self, path):
          """
          :Description: loads models of already constructed hierarchy
  
          :param str path: a path where hierarchy was saved by hARTM.save method
  
          :Notes:
            * Loaded models will overwrite ARTM.topic_names and class_ids fields of each level.
            * All class_ids weights will be set to 1.0, you need to specify them by\
              hand if it's necessary.
            * The method call will empty ARTM.score_tracker of each level.
            * All regularizers and scores will be forgotten.
            * etc.
            * We strongly recommend you to reset all important parameters of the ARTM\
              models and hARTM, used earlier.
          """
          info_filename = glob.glob(os.path.join(path, "info.dump"))
          if len(info_filename) != 1:
              raise ValueError("Given path is not hARTM safe")
  
          with open(info_filename[0], "rb") as fin:
              info = pickle.load(fin)
  
          model_filenames = glob.glob(os.path.join(path, "*.model"))
          if len({len(info["parent_level_weight"]) + 1, len(model_filenames) / 2}) > 1:
              raise ValueError("Given path is not hARTM safe")
  
          model_filenames = sorted(model_filenames)
  
          self._levels = []
          for level_idx, num_topics in enumerate(info["num_level_topics"]):
              if not len(self._levels):
                  model = artm.ARTM(num_topics=num_topics,
                                    seed=self._get_seed(level_idx),
                                    **self._common_models_args)
              else:
                  parent_level_weight = info["parent_level_weight"][level_idx - 1]
                  model = ARTM_Level(parent_model=self._levels[-1],
                                     phi_batch_weight=parent_level_weight,
                                     phi_batch_path=self._tmp_files_path,
                                     num_topics=num_topics,
                                     seed=self._get_seed(level_idx),
                                     **self._common_models_args)
  
              filename = model_filenames[2 * level_idx + 1]
              model.load(filename, "p_wt")
              filename = model_filenames[2 * level_idx]
              model.load(filename, "n_wt")
  
              config = model.master._config
              config.opt_for_avx = False
  
              model.master._lib.ArtmReconfigureMasterModel(
                  model.master.master_id, config)
              self._levels.append(model)
function_tokens: def load ( self , path ) : info_filename = glob . glob ( os . path . join ( path , "info.dump" ) ) if len ( info_filename ) != 1 : raise ValueError ( "Given path is not hARTM safe" ) with open ( info_filename [ 0 ] , "rb" ) as fin : info = pickle . load ( fin ) model_filenames = glob . glob ( os . path . join ( path , "*.model" ) ) if len ( { len ( info [ "parent_level_weight" ] ) + 1 , len ( model_filenames ) / 2 } ) > 1 : raise ValueError ( "Given path is not hARTM safe" ) model_filenames = sorted ( model_filenames ) self . _levels = [ ] for level_idx , num_topics in enumerate ( info [ "num_level_topics" ] ) : if not len ( self . _levels ) : model = artm . ARTM ( num_topics = num_topics , seed = self . _get_seed ( level_idx ) , * * self . _common_models_args ) else : parent_level_weight = info [ "parent_level_weight" ] [ level_idx - 1 ] model = ARTM_Level ( parent_model = self . _levels [ - 1 ] , phi_batch_weight = parent_level_weight , phi_batch_path = self . _tmp_files_path , num_topics = num_topics , seed = self . _get_seed ( level_idx ) , * * self . _common_models_args ) filename = model_filenames [ 2 * level_idx + 1 ] model . load ( filename , "p_wt" ) filename = model_filenames [ 2 * level_idx ] model . load ( filename , "n_wt" ) config = model . master . _config config . opt_for_avx = False model . master . _lib . ArtmReconfigureMasterModel ( model . master . master_id , config ) self . _levels . append ( model )