Open kengberg opened 6 years ago
Are you sure the config
matches the config the model was trained on? The error message implies that it was trained using bidirectional: True
.
Well - if I train a model, save the hdf5-weights - upload it, without changing any settings - the it still throws me an error..
I've just added the 6 lines to your original Colaboratory document..
You'd need to upload and specify the config
and the vocab
as well when creating the textgenrnn
instance. (Colaboratory can only upload one file at a time, which makes this inconvenient)
Well - I just thought it would work, now that the other examples slided past without problems..
I can't just manually change the settings in the second codeblock of yours?
The other examples assume the model is in the default textgenrnn
configuration. (128 cell, 2 layers, not bidirectional). The Colaboratory config deliberately uses a different configuration to make full utilization of the GPU.
Even if I write the parameters from the config.json-file, in the settings-box in colaboratory and run it - not even then, will it run without errors..
Solution to that topic is to provide VOCAB, WEIGHT & CONFIG that was used for training back to the function that should evaluate/create new texts:
textgen = textgenrnn(weights_path='textgenrnn_weights.hdf5', vocab_path='textgenrnn_vocab.json', config_path='textgenrnn_config.json') textgen.generate_samples()
Yess..
The problem is to do that in Collaboratory.
If I save a .hdf5-file from Collaboratory and try uploading it with:
from textgenrnn import textgenrnn uploaded = files.upload() all_files = [(name, os.path.getmtime(name)) for name in os.listdir()] latest_file = sorted(all_files, key=lambda x: -x[1])[0][0]
and then
textgen = textgenrnn(latest_file) textgen.generate(20, temperature=0.8)
Then it throws this error:
`--------------------------------------------------------------------------- ValueError Traceback (most recent call last)