def _create_modalities(self): """ Creates source and target modalities. Returns: A tuple `(input_modality, target_modality)`. """ input_modality_params = deep_merge_dict( self.params["modality.params"], self.params["modality.source.params"]) input_modality = Modality( params=input_modality_params, mode=self.mode, vocab_size=self._vocab_source.vocab_size, body_input_depth=self.params["embedding.dim.source"], name="input_symbol_modality", verbose=self.verbose) target_modality_params = deep_merge_dict( self.params["modality.params"], self.params["modality.target.params"]) target_modality = Modality( params=target_modality_params, mode=self.mode, vocab_size=self._vocab_target.vocab_size, body_input_depth=self.params["embedding.dim.target"], name="target_symbol_modality", verbose=self.verbose) return input_modality, target_modality
def main(_argv): model_configs = maybe_load_yaml(DEFAULT_EVAL_CONFIGS) # load flags from config file model_configs = load_from_config_path(FLAGS.config_paths, model_configs) # replace parameters in configs_file with tf FLAGS model_configs = update_eval_model_configs(model_configs, FLAGS) model_configs = deep_merge_dict(model_configs, ModelConfigs.load(FLAGS.model_dir)) model_configs = update_eval_model_configs(model_configs, FLAGS) runner = EvalExperiment(model_configs=model_configs) runner.run()
def main(_argv): # load flags from config file model_configs = load_from_config_path(FLAGS.config_paths) # replace parameters in configs_file with tf FLAGS model_configs = update_configs_from_flags(model_configs, FLAGS, EVAL_ARGS.keys()) model_configs = deep_merge_dict(model_configs, ModelConfigs.load(FLAGS.model_dir)) model_configs = update_configs_from_flags(model_configs, FLAGS, EVAL_ARGS.keys()) runner = EvalExperiment(model_configs=model_configs) runner.run()
def main(_argv): model_configs = maybe_load_yaml(DEFAULT_INFER_CONFIGS) # load flags from config file model_configs = load_from_config_path(FLAGS.config_paths, model_configs) # replace parameters in configs_file with tf FLAGS model_configs = update_infer_model_configs(model_configs, FLAGS) model_dirs = FLAGS.model_dir.strip().split(",") if len(model_dirs) == 1: model_configs = deep_merge_dict(model_configs, ModelConfigs.load(model_dirs[0])) model_configs = update_infer_model_configs(model_configs, FLAGS) runner = InferExperiment(model_configs=model_configs) else: runner = EnsembleExperiment(model_configs=model_configs, model_dirs=model_dirs, weight_scheme=FLAGS.weight_scheme) runner.run()
def main(_argv): model_configs = maybe_load_yaml(DEFAULT_INFER_CONFIGS) # load flags from config file model_configs = load_from_config_path(FLAGS.config_paths, model_configs) # replace parameters in configs_file with tf FLAGS model_configs = update_infer_model_configs(model_configs, FLAGS) model_dirs = FLAGS.model_dir.strip().split(",") if len(model_dirs) == 1: model_configs = deep_merge_dict(model_configs, ModelConfigs.load(model_dirs[0])) runner = InferExperiment(model_configs=model_configs) else: runner = EnsembleExperiment(model_configs=model_configs, model_dirs=model_dirs, weight_scheme=FLAGS.weight_scheme) runner.run()