Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Add assert for QAInferencer's max_seq_len & doc_stride #510

@tanaysoni

Description

@tanaysoni

The QAInferencer throws an error when the max_seq_len is less than the doc_stride.

Here's the stack trace:

  File "../haystack/haystack/finder.py", line 61, in get_answers
    top_k=top_k_reader)  # type: Dict[str, Any]
  File "../haystack/haystack/reader/farm.py", line 324, in predict
    objects=inputs, return_json=False, multiprocessing_chunksize=1
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/infer.py", line 699, in inference_from_objects
    multiprocessing_chunksize=multiprocessing_chunksize, streaming=streaming)
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/infer.py", line 682, in inference_from_dicts
    multiprocessing_chunksize=multiprocessing_chunksize, streaming=streaming)
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/infer.py", line 433, in inference_from_dicts
    predictions = self._inference_without_multiprocessing(dicts, return_json, aggregate_preds)
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/infer.py", line 477, in _inference_without_multiprocessing
    dicts, indices=[i for i in range(len(dicts))], return_baskets=True
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/data_handler/processor.py", line 1166, in dataset_from_dicts
    self._featurize_samples()
  File "../.pyenv/versions/3.7.6/envs/haystack/lib/python3.7/site-packages/farm/data_handler/processor.py", line 297, in _featurize_samples
    for sample in basket.samples:
TypeError: 'NoneType' object is not iterable

It might also be nice to have assertions on other parameters that they have values within a reasonable range.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions