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

Error when run inference #13

Closed
tringn opened this issue Jun 4, 2019 · 2 comments
Closed

Error when run inference #13

tringn opened this issue Jun 4, 2019 · 2 comments

Comments

@tringn
Copy link

tringn commented Jun 4, 2019

Hi @IsaacChanghau,
Thanks for your great work.
I have an issue when running inference. I restore the checkpoint and predict tag for the input sentence. But the error occurs. Can you help me?

2019-06-04 10:58:58.520794: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library libcublas.so.10.0 locally
2019-06-04 10:58:58.700894: W tensorflow/core/framework/op_kernel.cc:1401] OP_REQUIRES failed at conv_ops.cc:437 : Invalid argument: Computed output size would be negative: -1 [input_size: 3, effective_filter_size: 5, stride: 1]
2019-06-04 10:58:58.700985: W tensorflow/core/framework/op_kernel.cc:1401] OP_REQUIRES failed at conv_ops.cc:437 : Invalid argument: Computed output size would be negative: -1 [input_size: 3, effective_filter_size: 5, stride: 1]
Computed output size would be negative: -1 [input_size: 3, effective_filter_size: 5, stride: 1]
	 [[node embeddings/multi_conv1d/conv1d_1/Conv2D (defined at /home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/nns.py:56) ]]
	 [[node project/dense/BiasAdd (defined at /home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/blstm_cnn_crf_model.py:117) ]]

Caused by op 'embeddings/multi_conv1d/conv1d_1/Conv2D', defined at:
  File "predict_text.py", line 106, in <module>
    model = SequenceLabelModel(config)
  File "/home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/blstm_cnn_crf_model.py", line 13, in __init__
    super(SequenceLabelModel, self).__init__(config)
  File "/home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/base_model.py", line 16, in __init__
    self._build_embedding_op()
  File "/home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/blstm_cnn_crf_model.py", line 68, in _build_embedding_op
    drop_rate=self.drop_rate, is_train=self.is_train)
  File "/home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/nns.py", line 69, in multi_conv1d
    scope="conv1d_{}".format(i))
  File "/home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/nns.py", line 56, in conv1d
    xxc = tf.nn.conv2d(in_, filter_, strides, padding) + bias
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 1026, in conv2d
    data_format=data_format, dilations=dilations, name=name)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
    op_def=op_def)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in __init__
    self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Computed output size would be negative: -1 [input_size: 3, effective_filter_size: 5, stride: 1]
	 [[node embeddings/multi_conv1d/conv1d_1/Conv2D (defined at /home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/nns.py:56) ]]
	 [[node project/dense/BiasAdd (defined at /home/erv-trinn/workspace/keyphrase_extraction/neural_sequence_labeling/models/blstm_cnn_crf_model.py:117) ]]```
@CelineChen95
Copy link

How to run inference ? i haven't seen the inference script?

@tringn
Copy link
Author

tringn commented Apr 15, 2020

Hi @CelineChen95,
You can use
model = SequenceLabelModel(config)
model.restore_last_session()
and model.inference(your_sentence)

@tringn tringn closed this as completed Aug 5, 2020
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