victordibia / neuralqa

NeuralQA: A Usable Library for Question Answering on Large Datasets with BERT
https://victordibia.github.io/neuralqa/
MIT License
233 stars 32 forks source link

Transformers 4.x Compatibility Issue #63

Open andrewrreed opened 3 years ago

andrewrreed commented 3 years ago

Issue

NeuralQA's requirements do not have pinned package versions, instead they use >= to pull the latest version of each library. With the latest release of transformers, there is a compatibility issue with NeuralQA <> Tensorflow <> Transformers.

UI Error

image

Error Message

INFO:     127.0.0.1:53966 - "POST /api/answers HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 376, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 188, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 135, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/lib/python3.8/site-packages/neuralqa/server/routehandlers.py", line 45, in get_answers
    answers = self.reader_pool.model.answer_question(
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 111, in answer_question
    answer = self.get_chunk_answer_span(model_input)
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 26, in get_chunk_answer_span
    answer_start, answer_end = self.get_best_start_end_position(
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 18, in get_best_start_end_position
    answer_start = tf.argmax(start_scores, axis=1).numpy()[0]
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/math_ops.py", line 173, in argmax_v2
    return gen_math_ops.arg_max(input, axis, name=name, output_type=output_type)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_math_ops.py", line 837, in arg_max
    return arg_max_eager_fallback(
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_math_ops.py", line 872, in arg_max_eager_fallback
    _result = _execute.execute(b"ArgMax", 1, inputs=_inputs_flat, attrs=_attrs,
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.NotFoundError: Could not find valid device for node.
Node:{{node ArgMax}}
All kernels registered for op ArgMax :
  device='XLA_CPU'; output_type in [DT_INT32, DT_INT64]; Tidx in [DT_INT32, DT_INT64]; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, ..., DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]
  device='XLA_CPU_JIT'; output_type in [DT_INT32, DT_INT64]; Tidx in [DT_INT32, DT_INT64]; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, ..., DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]
  device='CPU'; T in [DT_INT64]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT64]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT32]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT32]; output_type in [DT_INT32]
  device='CPU'; T in [DT_UINT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_UINT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_UINT8]; output_type in [DT_INT64]
  device='CPU'; T in [DT_UINT8]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT8]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT8]; output_type in [DT_INT32]
  device='CPU'; T in [DT_HALF]; output_type in [DT_INT64]
  device='CPU'; T in [DT_HALF]; output_type in [DT_INT32]
  device='CPU'; T in [DT_BFLOAT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_BFLOAT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_FLOAT]; output_type in [DT_INT64]
  device='CPU'; T in [DT_FLOAT]; output_type in [DT_INT32]
  device='CPU'; T in [DT_DOUBLE]; output_type in [DT_INT64]
  device='CPU'; T in [DT_DOUBLE]; output_type in [DT_INT32]
 [Op:ArgMax]
ERROR:uvicorn.error:Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 376, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 188, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 135, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/lib/python3.8/site-packages/neuralqa/server/routehandlers.py", line 45, in get_answers
    answers = self.reader_pool.model.answer_question(
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 111, in answer_question
    answer = self.get_chunk_answer_span(model_input)
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 26, in get_chunk_answer_span
    answer_start, answer_end = self.get_best_start_end_position(
  File "/usr/local/lib/python3.8/site-packages/neuralqa/reader/bertreader.py", line 18, in get_best_start_end_position
    answer_start = tf.argmax(start_scores, axis=1).numpy()[0]
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/math_ops.py", line 173, in argmax_v2
    return gen_math_ops.arg_max(input, axis, name=name, output_type=output_type)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_math_ops.py", line 837, in arg_max
    return arg_max_eager_fallback(
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_math_ops.py", line 872, in arg_max_eager_fallback
    _result = _execute.execute(b"ArgMax", 1, inputs=_inputs_flat, attrs=_attrs,
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.NotFoundError: Could not find valid device for node.
Node:{{node ArgMax}}
All kernels registered for op ArgMax :
  device='XLA_CPU'; output_type in [DT_INT32, DT_INT64]; Tidx in [DT_INT32, DT_INT64]; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, ..., DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]
  device='XLA_CPU_JIT'; output_type in [DT_INT32, DT_INT64]; Tidx in [DT_INT32, DT_INT64]; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, ..., DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]
  device='CPU'; T in [DT_INT64]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT64]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT32]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT32]; output_type in [DT_INT32]
  device='CPU'; T in [DT_UINT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_UINT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_UINT8]; output_type in [DT_INT64]
  device='CPU'; T in [DT_UINT8]; output_type in [DT_INT32]
  device='CPU'; T in [DT_INT8]; output_type in [DT_INT64]
  device='CPU'; T in [DT_INT8]; output_type in [DT_INT32]
  device='CPU'; T in [DT_HALF]; output_type in [DT_INT64]
  device='CPU'; T in [DT_HALF]; output_type in [DT_INT32]
  device='CPU'; T in [DT_BFLOAT16]; output_type in [DT_INT64]
  device='CPU'; T in [DT_BFLOAT16]; output_type in [DT_INT32]
  device='CPU'; T in [DT_FLOAT]; output_type in [DT_INT64]
  device='CPU'; T in [DT_FLOAT]; output_type in [DT_INT32]
  device='CPU'; T in [DT_DOUBLE]; output_type in [DT_INT64]
  device='CPU'; T in [DT_DOUBLE]; output_type in [DT_INT32]
 [Op:ArgMax]
INFO:     127.0.0.1:53982 - "GET /images/icon.png HTTP/1.1" 304 Not Modified
INFO:     127.0.0.1:53984 - "GET /manifest.json HTTP/1.1" 304 Not Modified
INFO:     127.0.0.1:53982 - "GET /android-chrome-192x192.png HTTP/1.1" 304 Not Modified