Skip to content

Commit

Permalink
*fix matching_type
Browse files Browse the repository at this point in the history
  • Loading branch information
itamaker committed Apr 27, 2020
1 parent 02c2bd3 commit bd53776
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions delta/models/text_match_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def __init__(self, config, **kwargs):
self.padding = model_config['padding']
# The activation function
self.activation = model_config['activation']
self.matching_type = model_config['matching_type']

self.embed = tf.keras.layers.Embedding(
self.vocab_size,
Expand All @@ -159,8 +160,7 @@ def __init__(self, config, **kwargs):

self.embed_d = tf.keras.layers.Dropout(self.dropout_rate)

# TODO
self.matching_layer = MatchingLayer(matching_type='dot')
self.matching_layer = MatchingLayer(matching_type=self.matching_type)

self.conv = []
for i in range(self.num_blocks):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
data:
train:
paths:
- "egs/mock_text_match_data/text_match/v1/data/train.txt"
- "egs/mock_text_match_data/text_match/v1/data/msr.train"
eval:
paths:
- "egs/mock_text_match_data/text_match/v1/data/test.txt"
- "egs/mock_text_match_data/text_match/v1/data/msr.test"
infer:
paths:
- "egs/mock_text_match_data/text_match/v1/data/test.txt"
- "egs/mock_text_match_data/text_match/v1/data/msr.test"

infer_no_label: False
task:
Expand All @@ -17,7 +17,7 @@ data:
preparer:
enable: true
name: TextMatchPreparer
done_sign: "egs/mock_text_match_data/text_match/v1/exp/prepare.done"
done_sign: "egs/mock_text_match_data/text_match/v1/exp/prepare.msr.done"
reuse: false
use_dense: false
language: english
Expand All @@ -26,15 +26,15 @@ data:
split_by_space: false
use_word: true
use_custom_vocab: true
text_vocab: "egs/mock_text_match_data/text_match/v1/data/text_vocab.txt"
label_vocab: "egs/mock_text_match_data/text_match/v1/exp/label_vocab.txt"
text_vocab: "egs/mock_text_match_data/text_match/v1/data/text_vocab.txt.msr"
label_vocab: "egs/mock_text_match_data/text_match/v1/exp/label_vocab.txt.msr"
max_seq_len: 42
num_parallel_calls: 12
num_prefetch_batch: 2
shuffle_buffer_size: 15000
need_shuffle: true
batch_size: 30
epochs: 2
epochs: 30
classes:
positive_id: 1
num_classes: 2
Expand All @@ -48,7 +48,7 @@ model:
type: keras
use_pre_train_emb: false
pre_train_emb_path: ""
embedding_path: "egs/mock_text_match_data/text_match/v1/exp/embeding.pkl"
embedding_path: "egs/mock_text_match_data/text_match/v1/exp/embeding.msr.pkl"

net:
structure:
Expand All @@ -58,11 +58,12 @@ model:
cell_dim: 100
lstm_num_units: 256 #256
fc_num_units: 100 #100
dropout_rate: 0.2
dropout_rate: 0.0
l2_reg_lambda: 4e-6
activate: relu
sent_hidden_size: 300
# new
# pyramid
matching_type: dot
num_blocks: 1
kernel_count: 32
kernel_size:
Expand All @@ -72,7 +73,7 @@ model:
- 3
- 10
padding: same
activation: relu
activation: tanh

solver:
name: RawMatchSolver
Expand Down Expand Up @@ -109,9 +110,9 @@ solver:
average: 'weighted'
postproc:
name: SavePredPostProc
res_file: "egs/mock_text_match_data/text_match/v1/exp/text-match/res.txt"
res_file: "egs/mock_text_match_data/text_match/v1/exp/text-match/res.msr.txt"
saver:
model_path: "egs/mock_text_match_data/text_match/v1/exp/text-match/ckpt"
model_path: "egs/mock_text_match_data/text_match/v1/exp/text-match/ckpt-msr"
max_to_keep: 30 #30
save_checkpoint_steps: 10 #100
print_every: 10
Expand Down

0 comments on commit bd53776

Please sign in to comment.