ottokart / punctuator2

A bidirectional recurrent neural network model with attention mechanism for restoring missing punctuation in unsegmented text
http://bark.phon.ioc.ee/punctuator
MIT License
657 stars 195 forks source link

Issues while executing play_with_model.py #70

Open bishwaraj13 opened 3 years ago

bishwaraj13 commented 3 years ago

I execute: python play_with_model.py INTERSPEECH-T-BRNN-pre.pcl

It prompts me for text. I type: welcome to the tournament i am your host gabriel

I get following error:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/theano/compile/function_module.py", line 903, in call
self.fn() if output_subset is None else\
ValueError: cannot reshape array of size 500 into shape (10,256)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "play_with_model.py", line 109, in
punctuate(predict, word_vocabulary, punctuation_vocabulary, reverse_punctuation_vocabulary, reverse_word_vocabulary, text, f_out, show_unk)
File "play_with_model.py", line 45, in punctuate
y = predict(to_array(converted_subsequence))
File "/usr/local/lib/python3.6/dist-packages/theano/compile/function_module.py", line 917, in call
storage_map=getattr(self.fn, 'storage_map', None))
File "/usr/local/lib/python3.6/dist-packages/theano/gof/link.py", line 325, in raise_with_op reraise(exc_type, exc_value, exc_trace) File "/usr/local/lib/python3.6/dist-packages/six.py", line 702, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/dist-packages/theano/compile/function_module.py", line 903, in call self.fn() if output_subset is None else\ ValueError: cannot reshape array of size 500 into shape (10,256) Apply node that caused the error: Reshape{2}(AdvancedSubtensor1.0, Join.0) Toposort index: 33 Inputs types: [TensorType(float64, matrix), TensorType(int64, vector)] Inputs shapes: [(10, 50), (2,)] Inputs strides: [(400, 8), (8,)] Inputs values: ['not shown', array([ 10, 256])] Outputs clients: [[InplaceDimShuffle{0,x,1}(Reshape{2}.0)]]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer): File "play_withmodel.py", line 93, in net, = models.load(model_file, 1, x) File "/workspace/video_archive/gpu_user/bishwaraj/punctuator2/models.py", line 79, in load p=p File "/workspace/video_archive/gpu_user/bishwaraj/punctuator2/models.py", line 208, in init x_emb = self.We[x.flatten()].reshape((x.shape[0], minibatch_size, n_emb))

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.