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

ValueError: Shape mismatch in layer #2 (named rnn_1) for weight rnn_1/lstm_cell/bias. Weight expects shape (512,). Received saved weight with shape (1024,) #274

Open
alexdrymonitis opened this issue Sep 20, 2024 · 0 comments

Comments

@alexdrymonitis
Copy link

I managed to import textgenrnn after setting up manually, because of the error here, and removing dots in from .utils import..., but when I type the following, I get the error of the subject line, which disables me from creating a textgenrnn() object:

textgen = textgenrnn()

This error is triggered by the following line in model.py.

File "/home/alex/Documents/python/TensorFlow_various/TensorFlow2/textgenrnn/textgenrnn/model.py", line 39, in textgenrnn_model
    model.load_weights(weights_path, by_name=True)

In textgenrnn.py, there's this:

        if weights_path is None:
            weights_path = resource_filename(__name__,
                                             'textgenrnn_weights.hdf5')

This tries to load the textgenrnn_weights.hdf5 file, which is a compressed type of file, that obviously contains some wrong data, compared to what the code expects.
Reading this notebook, under "Training a New Model", I can't see how this can be overriden so a textgenrnn() object can be created.
Any ideas?

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

1 participant