From 48df21592f0325f54fc4ba63a9390424c001aaca Mon Sep 17 00:00:00 2001 From: malin10 Date: Tue, 2 Jun 2020 13:44:12 +0800 Subject: [PATCH] fix hyper_parameters --- models/match/dssm/config.yaml | 4 ++-- models/match/dssm/model.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/match/dssm/config.yaml b/models/match/dssm/config.yaml index cf68f993..536b0948 100755 --- a/models/match/dssm/config.yaml +++ b/models/match/dssm/config.yaml @@ -32,8 +32,8 @@ hyper_parameters: class: sgd learning_rate: 0.01 strategy: async - TRIGRAM_D: 1000 - NEG: 4 + trigram_d: 1000 + neg_num: 4 fc_sizes: [300, 300, 128] fc_acts: ['tanh', 'tanh', 'tanh'] diff --git a/models/match/dssm/model.py b/models/match/dssm/model.py index 23b31efc..1b0520e1 100755 --- a/models/match/dssm/model.py +++ b/models/match/dssm/model.py @@ -23,8 +23,8 @@ class Model(ModelBase): ModelBase.__init__(self, config) def _init_hyper_parameters(self): - self.TRIGRAM_D = envs.get_global_env("hyper_parameters.TRIGRAM_D") - self.Neg = envs.get_global_env("hyper_parameters.NEG") + self.trigram_d = envs.get_global_env("hyper_parameters.trigram_d") + self.neg_num = envs.get_global_env("hyper_parameters.neg_num") self.hidden_layers = envs.get_global_env("hyper_parameters.fc_sizes") self.hidden_acts = envs.get_global_env("hyper_parameters.fc_acts") self.learning_rate = envs.get_global_env( @@ -33,12 +33,12 @@ class Model(ModelBase): def input_data(self, is_infer=False, **kwargs): query = fluid.data( name="query", - shape=[-1, self.TRIGRAM_D], + shape=[-1, self.trigram_d], dtype='float32', lod_level=0) doc_pos = fluid.data( name="doc_pos", - shape=[-1, self.TRIGRAM_D], + shape=[-1, self.trigram_d], dtype='float32', lod_level=0) @@ -48,9 +48,9 @@ class Model(ModelBase): doc_negs = [ fluid.data( name="doc_neg_" + str(i), - shape=[-1, self.TRIGRAM_D], + shape=[-1, self.trigram_d], dtype="float32", - lod_level=0) for i in range(self.Neg) + lod_level=0) for i in range(self.neg_num) ] return [query, doc_pos] + doc_negs -- GitLab