Skip to content

file path issue #7

@FrankYFTang

Description

@FrankYFTang

Test code

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")

Traceback (most recent call last):
File "test_file.py", line 42, in
main(sys.argv[1:])
File "test_file.py", line 31, in main
word_segmenter = pick_lstm_model(model_name="Thai_codepoints_exclusive_model4_heavy",
File "/usr/local/google/home/ftang/lstm_word_segmentation/lstm_word_segmentation/word_segmenter.py", line 655, 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 181, in load_model
isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))):
File "/usr/local/google/home/ftang/.local/lib/python3.8/site-packages/h5py/_hl/base.py", line 41, in is_hdf5
fname = os.path.abspath(fspath(fname))
TypeError: expected str, bytes or os.PathLike object, not PosixPath

Looks like we need to wrap the file with str()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions