nytud / emtsv

e-magyar text processing system -- inter-module communication via tsv + REST API
GNU Lesser General Public License v3.0
27 stars 11 forks source link

Errors on Rest API #13

Closed levaid closed 3 years ago

levaid commented 4 years ago

Hello,

I wanted to start the latest docker image with the given command to run it through Rest API, and I got a pretty long traceback to the emBERT module. This is my full terminal output:

> sudo docker run --rm -p5000:5000 -it mtaril/emtsv
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.19.1 (64bit) on [Tue Nov  3 10:24:59 2020] ***
compiled with version: 8.3.0 on 25 August 2020 13:52:44
os: Linux-5.8.16-200.fc32.x86_64 #1 SMP Mon Oct 19 14:17:16 UTC 2020
nodename: 55fc1ad1eafc
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 16
current working directory: /app
detected binary path: /usr/local/bin/uwsgi
setgid() to 107
setuid() to 105
chdir() to /app
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 0.0.0.0:5000 fd 3
Python version: 3.8.1 (default, Feb  2 2020, 08:37:37)  [GCC 8.3.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55f73af80210
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 329352 bytes (321 KB) for 2 cores
*** Operational MODE: preforking ***
added /app/ to pythonpath.
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 6)
spawned uWSGI worker 1 (pid: 7, cores: 1)
spawned uWSGI worker 2 (pid: 8, cores: 1)
mapping worker 1 to CPUs: 0
mapping worker 2 to CPUs: 1
mounting docker/emtsvREST.wsgi on /
mounting docker/emtsvREST.wsgi on /
/usr/local/lib/python3.8/site-packages/npyscreen/proto_fm_screen_area.py:150: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.show_from_y is 0 and \
/usr/local/lib/python3.8/site-packages/npyscreen/proto_fm_screen_area.py:150: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.show_from_y is 0 and \
/usr/local/lib/python3.8/site-packages/npyscreen/proto_fm_screen_area.py:151: SyntaxWarning: "is" with a literal. Did you mean "=="?
  self.show_from_x is 0 and \
/usr/local/lib/python3.8/site-packages/npyscreen/proto_fm_screen_area.py:151: SyntaxWarning: "is" with a literal. Did you mean "=="?
  self.show_from_x is 0 and \
/usr/local/lib/python3.8/site-packages/npyscreen/npyspmfuncs.py:29: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if rtn is not 0: return False
/usr/local/lib/python3.8/site-packages/npyscreen/npyspmfuncs.py:29: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if rtn is not 0: return False
/usr/local/lib/python3.8/site-packages/npyscreen/wgmultiline.py:476: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.values[counter].find(searchingfor) is not -1:
/usr/local/lib/python3.8/site-packages/npyscreen/wgmultiline.py:476: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.values[counter].find(searchingfor) is not -1:
/usr/local/lib/python3.8/site-packages/npyscreen/wgautocomplete.py:61: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(possibilities) is 0:
/usr/local/lib/python3.8/site-packages/npyscreen/wgautocomplete.py:61: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(possibilities) is 0:
/usr/local/lib/python3.8/site-packages/npyscreen/wgautocomplete.py:66: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(possibilities) is 1:
/usr/local/lib/python3.8/site-packages/npyscreen/wgautocomplete.py:66: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(possibilities) is 1:
/usr/local/lib/python3.8/site-packages/npyscreen/wgcombobox.py:15: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if value is 0:
/usr/local/lib/python3.8/site-packages/npyscreen/wgcombobox.py:15: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if value is 0:
/usr/local/lib/python3.8/site-packages/npyscreen/wgcombobox.py:29: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.value == None or self.value is '':
/usr/local/lib/python3.8/site-packages/npyscreen/wgcombobox.py:29: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.value == None or self.value is '':
/usr/local/lib/python3.8/site-packages/npyscreen/wgmonthbox.py:224: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if thisday is 0:
/usr/local/lib/python3.8/site-packages/npyscreen/wgmonthbox.py:224: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if thisday is 0:
WSGI app 0 (mountpoint='/') ready in 1 seconds on interpreter 0x55f73af80210 pid: 7 (default app)
WSGI app 0 (mountpoint='/') ready in 1 seconds on interpreter 0x55f73af80210 pid: 8 (default app)
/usr/local/lib/python3.8/site-packages/scipy/optimize/_shgo.py:495: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if cons['type'] is 'ineq':
/usr/local/lib/python3.8/site-packages/scipy/optimize/_shgo.py:743: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(self.X_min) is not 0:
[2020-11-03 10:25:10,227] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/xtsv/pipeline.py", line 455, in get
    curr_tools = lazy_init_tools([fun], self._internal_apps, self._presets, self._singleton_store)
  File "/usr/local/lib/python3.8/site-packages/xtsv/pipeline.py", line 110, in lazy_init_tools
    importlib.import_module(module), prog   # Silently import everything for the JAVA CLASSPATH...
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/embert/embert/__init__.py", line 4, in <module>
    from .embert import EmBERT
  File "/app/embert/embert/embert.py", line 12, in <module>
    from transformers import BertTokenizer
  File "/usr/local/lib/python3.8/site-packages/transformers/__init__.py", line 48, in <module>
    from .data import (
  File "/usr/local/lib/python3.8/site-packages/transformers/data/__init__.py", line 6, in <module>
    from .processors import (
  File "/usr/local/lib/python3.8/site-packages/transformers/data/processors/__init__.py", line 5, in <module>
    from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
  File "/usr/local/lib/python3.8/site-packages/transformers/data/processors/glue.py", line 25, in <module>
    from ...tokenization_utils import PreTrainedTokenizer
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 26, in <module>
    from .tokenization_utils_base import (
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1015, in <module>
    class PreTrainedTokenizerBase(SpecialTokensMixin):
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1389, in PreTrainedTokenizerBase
    def encode(
  File "/usr/local/lib/python3.8/site-packages/transformers/file_utils.py", line 183, in docstring_decorator
    fn.__doc__ = fn.__doc__ + "".join(docstr)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
[pid: 8|app: 0|req: 1/1] 172.17.0.1 () {42 vars in 1437 bytes} [Tue Nov  3 10:25:07 2020] GET / => generated 37 bytes in 2244 msecs (HTTP/1.1 500) 2 headers in 90 bytes (1 switches on core 0)
/usr/local/lib/python3.8/site-packages/scipy/optimize/_shgo.py:495: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if cons['type'] is 'ineq':
/usr/local/lib/python3.8/site-packages/scipy/optimize/_shgo.py:743: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(self.X_min) is not 0:
[2020-11-03 10:25:12,034] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/xtsv/pipeline.py", line 455, in get
    curr_tools = lazy_init_tools([fun], self._internal_apps, self._presets, self._singleton_store)
  File "/usr/local/lib/python3.8/site-packages/xtsv/pipeline.py", line 110, in lazy_init_tools
    importlib.import_module(module), prog   # Silently import everything for the JAVA CLASSPATH...
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/embert/embert/__init__.py", line 4, in <module>
    from .embert import EmBERT
  File "/app/embert/embert/embert.py", line 12, in <module>
    from transformers import BertTokenizer
  File "/usr/local/lib/python3.8/site-packages/transformers/__init__.py", line 48, in <module>
    from .data import (
  File "/usr/local/lib/python3.8/site-packages/transformers/data/__init__.py", line 6, in <module>
    from .processors import (
  File "/usr/local/lib/python3.8/site-packages/transformers/data/processors/__init__.py", line 5, in <module>
    from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
  File "/usr/local/lib/python3.8/site-packages/transformers/data/processors/glue.py", line 25, in <module>
    from ...tokenization_utils import PreTrainedTokenizer
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 26, in <module>
    from .tokenization_utils_base import (
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1015, in <module>
    class PreTrainedTokenizerBase(SpecialTokensMixin):
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1389, in PreTrainedTokenizerBase
    def encode(
  File "/usr/local/lib/python3.8/site-packages/transformers/file_utils.py", line 183, in docstring_decorator
    fn.__doc__ = fn.__doc__ + "".join(docstr)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
[pid: 7|app: 0|req: 1/2] 172.17.0.1 () {42 vars in 1355 bytes} [Tue Nov  3 10:25:10 2020] GET /favicon.ico => generated 37 bytes in 1587 msecs (HTTP/1.1 500) 2 headers in 90 bytes (1 switches on core 0)
dlazesz commented 4 years ago

Thank you for your report!

Unfortunately this is a known bug, due to emBERT module. The transformers package is not pinned and the API has broken in the newer versions. We will provide a workaround soon, to keep things going until the new version of emBERT is released.

The bug only affects the REST API, so in the meantime we recommend using emtsv through CLI or build an own docker image without or with a modified version of emBERT.

levaid commented 4 years ago

This is why I was surprised - the CLI version that I have used a few days did not throw any errors, I wanted to try to REST API because I sometimes have problems with input formatting, and the REST API does not need to cold start after every try.

Thank you for the quick reply!

kbalint commented 3 years ago

I've run into this same problem, but going from :latest to a versioned one made the docker container at least useable (for example: docker pull mtaril/emtsv:4.0.1, docker run --rm -p5000:5000 -it mtaril/emtsv:4.0.1)

My further question is: would it be possible to set a default GET page for / ? It could return some version string for example, or possibly a Swagger UI for testing the API? (I just get an Internal Server error on a simple GET for http://localhost:5000)

Thanks!

dlazesz commented 3 years ago

My further question is: would it be possible to set a default GET page for / ? It could return some version string for example, or possibly a Swagger UI for testing the API? (I just get an Internal Server error on a simple GET for http://localhost:5000)

This is an offtopic question here. It would need a separate issue.

The lastest sources actually returns a basic WebUI for GET /. This would be the current intended behavior. If you gen an internal server error, please see the logs for details. It is definitely not the intended behavior, but possible due to this bug.

There are efforts on rewriting xtsv according to the user feedback. Some of the planned new features include Swagger UI.

dlazesz commented 3 years ago

New docker release is out! Thx to @mittelholcz https://hub.docker.com/repository/docker/mtaril/emtsv

Please test and if the issue persists, please reopen the issue. Thank you for your patience!