Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file path issue #7

Open
FrankYFTang opened this issue Jan 21, 2021 · 1 comment
Open

file path issue #7

FrankYFTang opened this issue Jan 21, 2021 · 1 comment

Comments

@FrankYFTang
Copy link
Collaborator

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

@SahandFarhoodi
Copy link
Collaborator

On my MacBook, this works with or without str. I think PosixPath is only compatible with Unix and some other platforms. If this is true then yes, we need that str around the file name. Are you running this code on Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants