I was attempting to create a RNN that would generate text from shakespearean literature, as taught by this tensorflow course: https://www.tensorflow.org/tutorials/text/text_generation
When I attempted to load the weights, my program would crash with the error message: AttributeError: 'NoneType' object has no attribute 'endswith'
Here is the line of code that crashes the program:
model.load_weights(tf.train.latest_checkpoint(check_dir))
Here is the pastebin of my code: https://pastebin.com/KqmD0phL
Here is the full error message:
Traceback (most recent call last):
File "D:/Python/PycharmProjects/untitled/Shakespeare.py", line 118, in <module>
main()
File "D:/Python/PycharmProjects/untitled/Shakespeare.py", line 108, in main
model.load_weights(tf.train.latest_checkpoint(check_dir))
File "C:\Users\marco\venv\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 182, in load_weights
return super(Model, self).load_weights(filepath, by_name)
File "C:\Users\marco\venv\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1335, in load_weights
if _is_hdf5_filepath(filepath):
File "C:\Users\marco\venv\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1645, in _is_hdf5_filepath
return (filepath.endswith('.h5') or filepath.endswith('.keras') or
AttributeError: 'NoneType' object has no attribute 'endswith'