NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

Matchpyramid not working for some text lengths #767

Closed jibrilfrej closed 5 years ago

jibrilfrej commented 5 years ago

Describe the bug

MatchPyramid does not work for some text lengths: if I set the preprocessor fixed_length_left and fixed_length_right parameters to some values: the model crashes.

I have mz version 2.1.0

I did not have this issue with the other models I tried ("ArcII", "KNRM", "DUET", "DRMMTKS")

To Reproduce

import matchzoo as mz

fixed_length_left=5
fixed_length_right=25
train_pack = mz.datasets.wiki_qa.load_data('train', task='ranking')
preprocessor = mz.preprocessors.BasicPreprocessor(fixed_length_left=fixed_length_left,
                                                  fixed_length_right=fixed_length_right)
model, preprocessor, data_generator_builder, embedding_matrix = mz.auto.prepare(
                    task=mz.tasks.Ranking(),
                    model_class=mz.models.match_pyramid.MatchPyramid,
                    data_pack=train_pack,
                    preprocessor=preprocessor
                    )
train_preprocessed = preprocessor.transform(train_pack,verbose=0)
train_gen = data_generator_builder.build(train_preprocessed)
model.fit_generator(train_gen, epochs=1)

Describe your attempts

uduse commented 5 years ago

Thanks for the snippet, it correctly reproduces the bug. I gave a quick look but it seems the bug's not that obvious and I need more time for investigation.

uduse commented 5 years ago

Fixed in #768

jibrilfrej commented 5 years ago

Thanks !!