amansrivastava17 / lstm-siamese-text-similarity

⚛️ It is keras based implementation of siamese architecture using lstm encoders to compute text similarity
MIT License
282 stars 88 forks source link

TypeError: list indices must be integers or slices, not str #2

Closed BATspock closed 6 years ago

BATspock commented 6 years ago

Traceback (most recent call last): File "lstm-siamese-text-similarity/controller.py", line 64, in best_model_path = siamese.train_model(sentences_pair, is_similar, embedding_meta_data) File "lstm-siamese-text-similarity/model.py", line 49, in train_model tokenizer, embedding_matrix = embedding_meta_data['tokenizer'], embedding_meta_data['embedding_matrix'] TypeError: list indices must be integers or slices, not str

I get the following error, I am unable to debug

ghost commented 6 years ago

@BATspock Try taking out the last parameter in controller line number 64. It should be like this best_model_path = siamese.train_model(sentences_pair, is_similar, embedding_meta_data)

BATspock commented 6 years ago

@johnkjoseph I thought the same and removed the last parameter, still got the same error

ghost commented 6 years ago

@BATspock You are right, that doesn't matter, the problem is in model.py line number 32. The first parameter there should be self like this def train_model(self, sentences_pair, is_similar, embedding_meta_data, model_save_directory='./'):

amansrivastava17 commented 6 years ago

@johnkjoseph Thanks for finding the bug. Have fixed.

BATspock commented 6 years ago

thanks a lot