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

Fix various "DeprecationWarning" and "RuntimeWarning" from the code #526

Closed
lalitpagaria opened this issue Oct 28, 2020 · 0 comments · Fixed by #530
Closed

Fix various "DeprecationWarning" and "RuntimeWarning" from the code #526

lalitpagaria opened this issue Oct 28, 2020 · 0 comments · Fixed by #530
Labels
type:bug Something isn't working

Comments

@lalitpagaria
Copy link
Contributor

Describe the bug
Many underlaying libraries throwing DeprecationWarning and RuntimeWarning. Some are serious in the nature so better to address them before it's too late.

Error message
Error that was thrown (if available): Listing all the warning showing during pytest run

============================== warnings summary ===============================
../../../../../../opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/dotmap/__init__.py:2
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/dotmap/__init__.py:2: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from collections import OrderedDict, MutableMapping

../haystack/preprocessor/utils.py:203
  /home/runner/work/haystack/haystack/haystack/preprocessor/utils.py:203: DeprecationWarning: invalid escape sequence \s
    if merge_short and len(para) < 10 or len(re.findall('\s+', para)) < 2 \

../haystack/preprocessor/utils.py:204
  /home/runner/work/haystack/haystack/haystack/preprocessor/utils.py:204: DeprecationWarning: invalid escape sequence \]
    or merge_lowercase and para and para[0].islower() and last_para and last_para[-1] not in '.?!"\'\]\)':

../../../../../../opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/docx/section.py:7
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/docx/section.py:7: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from collections import Sequence

../../../../../../opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/importlib/_bootstrap.py:219
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
    return f(*args, **kwds)

test_db.py::test_elasticsearch_update_meta[elasticsearch]
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/elasticsearch/connection/base.py:190: ElasticsearchDeprecationWarning: [types removal] Specifying types in document update requests is deprecated, use the endpoint /{index}/_update/{id} instead.
    warnings.warn(message, category=ElasticsearchDeprecationWarning)

test_dpr_retriever.py::test_dpr_retrieval[True-dpr-elasticsearch]
test_dpr_retriever.py::test_dpr_retrieval[True-dpr-faiss]
test_dpr_retriever.py::test_dpr_retrieval[True-dpr-memory]
test_dpr_retriever.py::test_dpr_retrieval[False-dpr-elasticsearch]
test_dpr_retriever.py::test_dpr_retrieval[False-dpr-faiss]
test_dpr_retriever.py::test_dpr_retrieval[False-dpr-memory]
test_faiss.py::test_faiss_update_docs[10000]
test_faiss.py::test_faiss_update_docs[2]
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/transformers/tokenization_utils_base.py:1773: FutureWarning: The `pad_to_max_length` argument is deprecated and will be removed in a future version, use `padding=True` or `padding='longest'` to pad to the longest sequence in the batch, or use `padding='max_length'` to pad to a max length. In this case, you can give a specific length with `max_length` (e.g. `max_length=45`) or leave max_length to None to pad to the maximal input size of the model (e.g. 512 for Bert).
    FutureWarning,

test_dpr_retriever.py::test_dpr_retrieval[True-dpr-elasticsearch]
  /home/runner/work/haystack/haystack/haystack/retriever/dense.py:199: UserWarning: This overload of nonzero is deprecated:
  	nonzero(Tensor input, *, Tensor out)
  Consider using one of the following signatures instead:
  	nonzero(Tensor input, *, bool as_tuple) (Triggered internally at  /pytorch/torch/csrc/utils/python_arg_parser.cpp:766.)
    no_title_indices = torch.nonzero(1 - titles_mask).squeeze(-1)

test_embedding_retriever.py::test_embedding_retriever[embedding-elasticsearch]
test_embedding_retriever.py::test_embedding_retriever[embedding-faiss]
test_embedding_retriever.py::test_embedding_retriever[embedding-memory]
test_faiss.py::test_faiss_retrieving
test_faiss.py::test_faiss_finding
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/transformers/tokenization_utils.py:460: FutureWarning: `is_pretokenized` is deprecated and will be removed in a future version, use `is_split_into_words` instead.
    FutureWarning,

test_eval.py: 3 warnings
test_finder.py: 12 warnings
test_reader.py: 10 warnings
test_rest_api.py: 1 warning
  /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/farm/infer.py:406: DeprecationWarning: QA Input dictionaries with [qas, context] as keys will be deprecated in the future
    DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========== 147 passed, 1 deselected, 46 warnings in 380.78s (0:06:20) ==========

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.

To Reproduce
Steps to reproduce the behavior

System:

  • OS:
  • GPU/CPU:
  • Haystack version (commit or version number):
  • DocumentStore:
  • Reader:
  • Retriever:
@lalitpagaria lalitpagaria added the type:bug Something isn't working label Oct 28, 2020
@lalitpagaria lalitpagaria changed the title Fix various DeprecationWarning and RuntimeWarning from the code Fix various "DeprecationWarning" and "RuntimeWarning" from the code Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant