GithubHelp home page GithubHelp logo

nlpbox / neuraleduseg-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wladimirsidorenko/neuraleduseg

0.0 0.0 3.0 158.13 MB

NeuralEDUSeg discourse segmention (Wang et al. 2018) in Docker with a REST API.

Home Page: https://arxiv.org/abs/1808.09147

License: Apache License 2.0

Python 98.87% Dockerfile 0.98% Makefile 0.16%

neuraleduseg-service's People

Contributors

arne-cl avatar stevenfontanella avatar wladimirsidorenko avatar yizhongw avatar

Watchers

 avatar  avatar

neuraleduseg-service's Issues

tensorflow InvalidArgumentError: num_lower must be negative or less or equal to number of rows

I discovered via issue NLPbox/stagedp-service#1 that NeuralEDUSeg crashes on some, mostly very short, input sentences:

$ cat /tmp/bad_input.txt                                                                                                                                                                        good food .

$ docker run -v /tmp:/tmp -it neural-edu-seg /tmp/bad_input.txt
Loading NeuralEDUSeg models...
[...]
Finished loading NeuralEDUSeg models.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call
    return fn(*args)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1329, in _run_fn
    status, run_metadata)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: num_lower must be negative or less or equal to number of rows (3) got: 5
         [[Node: encoding/bilinear_attention/MatrixBandPart = MatrixBandPart[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](encoding/bilinear_attention/ones_like, encoding/bilinear_attention/MatrixBandPart/num_lower,
encoding/bilinear_attention/MatrixBandPart/num_lower)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "neuralseg/splitter.py", line 334, in <module>
    main()
  File "neuralseg/splitter.py", line 323, in main
    result = segment_text(input_text, rst_data, model, spacy_nlp, output_format=args.output_format, debug=args.debug)
  File "neuralseg/splitter.py", line 279, in segment_text
    edus, spacy_edus, json_edus = segment_batches(model, data_batches, text, debug=debug)
  File "neuralseg/splitter.py", line 231, in segment_batches
    batch_edu_breaks = model.segment(batch)
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/elmo_crf_seg.py", line 125, in segment
    feed_dict)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run
    options, run_metadata)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: num_lower must be negative or less or equal to number of rows (3) got: 5
         [[Node: encoding/bilinear_attention/MatrixBandPart = MatrixBandPart[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](encoding/bilinear_attention/ones_like, encoding/bilinear_attention/MatrixBandPart/num_lower,
encoding/bilinear_attention/MatrixBandPart/num_lower)]]

Caused by op 'encoding/bilinear_attention/MatrixBandPart', defined at:
  File "neuralseg/splitter.py", line 334, in <module>
    main()
  File "neuralseg/splitter.py", line 321, in main
    rst_data, model, spacy_nlp = load_models(args)
  File "neuralseg/splitter.py", line 74, in load_models
    model = AttnSegModel(args, word_vocab)
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/elmo_crf_seg.py", line 17, in __init__
    super().__init__(args, word_vocab)
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/base_seg.py", line 37, in __init__
    self._build_graph()
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/lstm_seg.py", line 20, in _build_graph
    self._encode()
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/atten_seg.py", line 24, in _encode
    self.window_size)
  File "/usr/local/lib/python3.6/site-packages/neuralseg-0.1.0a0-py3.6.egg/neuralseg/layers.py", line 51, in self_attention
    window_size, window_size)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2409, in matrix_band_part
    num_upper=num_upper, name=name)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op
    op_def=op_def)
  File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): num_lower must be negative or less or equal to number of rows (3) got: 5
         [[Node: encoding/bilinear_attention/MatrixBandPart = MatrixBandPart[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](encoding/bilinear_attention/ones_like, encoding/bilinear_attention/MatrixBandPart/num_lower,
encoding/bilinear_attention/MatrixBandPart/num_lower)]]

Expected behaviour would be sth. like:

$ cat /tmp/good_input.txt 
Judging from previous posts this used to be a good place, but not any longer.

$ docker run -v /tmp:/tmp -it neural-edu-seg /tmp/good_input.txt
Loading NeuralEDUSeg models...
[...]
Finished loading NeuralEDUSeg models.
{"paragraphs": [{"start": 0, "end": 78}], "sentences": [{"start": 0, "end": 77}], "edus": [{"start": 0, "end": 28}, {"start": 28, "end": 77}]}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.