title: NoneType object has no attribute endwith (Tensorflow)
body: <p>I was attempting to create a RNN that would generate text from shakespearean literature, as taught by this tensorflow course: <a href="https://www.tensorflow.org/tutorials/text/text_generation" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/text_generation</a></p>
  
  <p>When I attempted to load the weights, my program would crash with the error message: AttributeError: 'NoneType' object has no attribute 'endswith'</p>
  
  <p>Here is the line of code that crashes the program:</p>
  
  <pre><code>model.load_weights(tf.train.latest_checkpoint(check_dir))
  </code></pre>
  
  <p>Here is the pastebin of my code: <a href="https://pastebin.com/KqmD0phL" rel="nofollow noreferrer">https://pastebin.com/KqmD0phL</a></p>
  
  <p>Here is the full error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/Python/PycharmProjects/untitled/Shakespeare.py", line 118, in &lt;module&gt;
      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'
  </code></pre>