# Python issue\_\_\_\_\_\_\_

**URL:** <https://forums.kodeco.com/t/python-issue/128112>\
**Category:** 🙃 Off Topic\
**Created:** [December 20, 2020, 10:26pm UTC](https://forums.kodeco.com/t/python-issue/128112 "2020-12-20T22:26:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lac\_ekim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lac_ekim/32/102075_2.png) [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Post date:** [December 20, 2020, 10:26pm UTC](https://forums.kodeco.com/t/python-issue/128112/1 "2020-12-20T22:26:51Z")

</div>

"Saving and Loading a Model  
In [76]:

from tensorflow.keras.models import load\_model  
In [77]:

model.save(‘my\_model.h5’) # creates a HDF5 file ‘my\_model.h5’  
In [78]:

## later\_model = load\_model(‘my\_model.h5’)

AttributeError Traceback (most recent call last)  
 in   
----\> 1 later\_model = load\_model(‘my\_model.h5’)

~/PycharmProjects/NNTrading/venv/lib/python3.7/site-packages/tensorflow\_core/python/keras/saving/save.py in load\_model(filepath, custom\_objects, compile)  
144 if (h5py is not None and (  
145 isinstance(filepath, h5py.File) or h5py.is\_hdf5(filepath))):  
 → 146 return hdf5\_format.load\_model\_from\_hdf5(filepath, custom\_objects, compile)  
147  
148 if isinstance(filepath, six.string\_types):

~/PycharmProjects/NNTrading/venv/lib/python3.7/site-packages/tensorflow\_core/python/keras/saving/hdf5\_format.py in load\_model\_from\_hdf5(filepath, custom\_objects, compile)  
164 if model\_config is None:  
165 raise ValueError(‘No model found in config file.’)  
 → 166 model\_config = json.loads(model\_config.decode(‘utf-8’))  
167 model = model\_config\_lib.model\_from\_config(model\_config,  
168 custom\_objects=custom\_objects)

AttributeError: ‘str’ object has no attribute ‘decode’

In [79]:

## later\_model.predict(new\_gem)

NameError Traceback (most recent call last)  
 in   
----\> 1 later\_model.predict(new\_gem)

NameError: name ‘later\_model’ is not defined  
"  
how do I fix this? im running python 3.7
