unicode-org/lstm_word_segmentation

Problem with KeyError: 'sample_weight_mode' when calling pick_lstm_model

FrankYFTang opened this issue · 2 comments

File "/usr/local/google/home/ftang/lstm_word_segmentation/lstm_word_segmentation/word_segmenter.py", line 656, in pick_lstm_model
model = keras.models.load_model(file)
File "/usr/local/google/home/ftang/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/save.py", line 190, in load_model
return saved_model_load.load(filepath, compile)
File "/usr/local/google/home/ftang/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 125, in load
model.compile(**saving_utils.compile_args_from_training_config(
File "/usr/local/google/home/ftang/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/saving_utils.py", line 230, in compile_args_from_training_config
sample_weight_mode = training_config['sample_weight_mode']
KeyError: 'sample_weight_mode'

from lstm_word_segmentation.word_segmenter import pick_lstm_model
   word_segmenter = pick_lstm_model(model_name="Thai_codepoints_exclusive_model4_heavy",
                                    embedding="codepoints",
                                    train_data="exclusive BEST",
                                    eval_data="exclusive BEST")

solved by running "pip install tensorflow==2.3.0"