Skip to content

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

Description

@alexdrymonitis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions