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

how to load weights back into the tensorflow. #9

Open
Pratyush852 opened this issue Nov 11, 2022 · 2 comments
Open

how to load weights back into the tensorflow. #9

Pratyush852 opened this issue Nov 11, 2022 · 2 comments

Comments

@Pratyush852
Copy link

No description provided.

@Pratyush852
Copy link
Author

Use the pre-trained model

trained_model = CFModel(max_userid, max_movieid, K_FACTORS)

Load weights

trained_model.load_weights('weights.h5')

It is showing error

AttributeError Traceback (most recent call last)
in
4 trained_model = CFModel(max_userid, max_movieid, K_FACTORS)
5 # Load weights
----> 6 trained_model.load_weights('weights.h5')

2 frames
/usr/local/lib/python3.7/dist-packages/keras/engine/topology.py in (.0)
2746 flattened_layers = filtered_layers
2747
-> 2748 layer_names = [n.decode('utf8') for n in f.attrs['layer_names']]
2749 filtered_layer_names = []
2750 for name in layer_names:

AttributeError: 'str' object has no attribute 'decode'

@HripsimeS
Copy link

trained_model = CFModel(max_userid, max_movieid, K_FACTORS)
trained_model([np.array([[1]]), np.array([[1]])]) # Pass the inputs as a list
trained_model.load_weights('weights.h5')

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