def eval_cl_model(): eval_from_vals = ["pretrain_cl", "final_cl"] assert flags.eval_from in eval_from_vals, "eval_from must be one of %s" % eval_from_vals if flags.eval_from == "final_cl": model_save_suffix = model_save_suffixes["train_cl_model"] else: model_save_suffix = model_save_suffixes["pre_train_cl_model"] save_model_path = osp.join(flags.save_model_dir, model_save_suffix) generator_model = AdversarialDDGModel( init_modules=AdversarialDDGModel.eval_cl_modules) generator_model.build(eval_cl=True) generator_model.eval(save_model_path=save_model_path)
def eval_generator(eval_batch_size=flags["eval_batch_size"], eval_topic_count=flags["eval_topic_count"], eval_seq_length=flags["eval_seq_length"]): eval_from_vals = ["generator", "topic_generator"] assert flags.eval_from in eval_from_vals, "eval_from must be one of %s" % eval_from_vals if flags.eval_from == "generator": model_save_suffix = model_save_suffixes["train_generator"] else: model_save_suffix = model_save_suffixes["train_topic_generator"] save_model_path = osp.join(flags.save_model_dir, model_save_suffix) generator_model = AdversarialDDGModel( init_modules=AdversarialDDGModel.eval_graph_modules) generator_model.build(eval_seq=True, batch_size=eval_batch_size, topic_count=eval_topic_count, seq_length=eval_seq_length) generator_model.eval(save_model_path=save_model_path)