anakin87 / haystack-entailment-checker

Haystack node for checking the entailment between a statement and a list of Documents
2 stars 1 forks source link

Version control issue with latest Haystack version (1.23.0) #1

Open OMGAmici opened 11 months ago

OMGAmici commented 11 months ago

Hi there!

I am running the latest version of Haystack 1.23.0 and tried installing this custom node to use as part of a pipeline.

It seems, however, that there is a version conflict with one of the libraries.

Stack trace with the main error at the bottom:

Traceback (most recent call last):
  File "/home/dev/g3/g3/bin/haystack", line 5, in <module>
    from haystack.cli.entry_point import main
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/__init__.py", line 11, in <module>
    from haystack.nodes.base import BaseComponent
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/__init__.py", line 22, in <module>
    from haystack.nodes.label_generator import PseudoLabelGenerator
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/label_generator/__init__.py", line 1, in <module>
    from haystack.nodes.label_generator.pseudo_label_generator import PseudoLabelGenerator
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/label_generator/pseudo_label_generator.py", line 8, in <module>
    from haystack.nodes.question_generator import QuestionGenerator
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/question_generator/__init__.py", line 1, in <module>
    from haystack.nodes.question_generator.question_generator import QuestionGenerator
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/question_generator/question_generator.py", line 10, in <module>
    from haystack.nodes.preprocessor import PreProcessor
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/preprocessor/__init__.py", line 1, in <module>
    from haystack.nodes.preprocessor.base import BasePreProcessor
  File "/home/dev/g3/g3/lib/python3.8/site-packages/haystack/nodes/preprocessor/base.py", line 5, in <module>
    from transformers import PreTrainedTokenizerBase
  File "/home/dev/g3/g3/lib/python3.8/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "/home/dev/g3/g3/lib/python3.8/site-packages/transformers/dependency_versions_check.py", line 57, in <module>
    require_version_core(deps[pkg])
  File "/home/dev/g3/g3/lib/python3.8/site-packages/transformers/utils/versions.py", line 117, in require_version_core
    return require_version(requirement, hint)
  File "/home/dev/g3/g3/lib/python3.8/site-packages/transformers/utils/versions.py", line 111, in require_version
    _compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
  File "/home/dev/g3/g3/lib/python3.8/site-packages/transformers/utils/versions.py", line 44, in _compare_versions
    raise ImportError(
ImportError: accelerate>=0.20.3 is required for a normal functioning of this module, but found accelerate==0.19.0.
Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main
anakin87 commented 11 months ago

🤔

Thanks for reporting this. I will take a look tomorrow...

anakin87 commented 11 months ago

I suggest reinstalling in a clean virtual environment.

I can't reproduce your issue. See this notebook.

OMGAmici commented 11 months ago

Thank you! I got the library dependency resolved.

Should the EntailmentChecker be compatible with a Haystack pipeline set up in a yaml file?

jsonschema.exceptions.ValidationError: {'name': 'NLI', 'type': 'EntailmentChecker', 'params': {'model_name_or_path': 'microsoft/deberta-v2-xlarge-mnli', 'use_gpu': True, 'entailment_contradiction_threshold': 0.5}} is not valid under any of the given schemas

Failed validating 'anyOf' in schema['properties']['components']['items']:
    {'anyOf': [{'$ref': '#/definitions/DeepsetCloudDocumentStoreComponent'},
               {'$ref': '#/definitions/ElasticsearchDocumentStoreComponent'},
               {'$ref': '#/definitions/FAISSDocumentStoreComponent'},
               {'$ref': '#/definitions/InMemoryDocumentStoreComponent'},
               {'$ref': '#/definitions/OpenSearchDocumentStoreComponent'},
               {'$ref': '#/definitions/PineconeDocumentStoreComponent'},
               {'$ref': '#/definitions/SQLDocumentStoreComponent'},
               {'$ref': '#/definitions/WeaviateDocumentStoreComponent'},
               {'$ref': '#/definitions/AnswerParserComponent'},
               {'$ref': '#/definitions/AzureConverterComponent'},
               {'$ref': '#/definitions/BM25RetrieverComponent'},
               {'$ref': '#/definitions/BaseOutputParserComponent'},
               {'$ref': '#/definitions/CohereRankerComponent'},
               {'$ref': '#/definitions/CrawlerComponent'},
               {'$ref': '#/definitions/CsvTextConverterComponent'},
               {'$ref': '#/definitions/DensePassageRetrieverComponent'},
               {'$ref': '#/definitions/DiversityRankerComponent'},
               {'$ref': '#/definitions/Docs2AnswersComponent'},
               {'$ref': '#/definitions/DocumentMergerComponent'},
               {'$ref': '#/definitions/DocxToTextConverterComponent'},
               {'$ref': '#/definitions/EmbeddingRetrieverComponent'},
               {'$ref': '#/definitions/EntityExtractorComponent'},
               {'$ref': '#/definitions/FARMReaderComponent'},
               {'$ref': '#/definitions/FileTypeClassifierComponent'},
               {'$ref': '#/definitions/FilterRetrieverComponent'},
               {'$ref': '#/definitions/ImageToTextConverterComponent'},
               {'$ref': '#/definitions/JoinAnswersComponent'},
               {'$ref': '#/definitions/JoinDocumentsComponent'},
               {'$ref': '#/definitions/JsonConverterComponent'},
               {'$ref': '#/definitions/LangdetectDocumentLanguageClassifierComponent'},
               {'$ref': '#/definitions/LinkContentFetcherComponent'},
               {'$ref': '#/definitions/LostInTheMiddleRankerComponent'},
               {'$ref': '#/definitions/MarkdownConverterComponent'},
               {'$ref': '#/definitions/MultiModalRetrieverComponent'},
               {'$ref': '#/definitions/MultihopEmbeddingRetrieverComponent'},
               {'$ref': '#/definitions/PDFToTextConverterComponent'},
               {'$ref': '#/definitions/ParsrConverterComponent'},
               {'$ref': '#/definitions/PptxConverterComponent'},
               {'$ref': '#/definitions/PreProcessorComponent'},
               {'$ref': '#/definitions/PromptModelComponent'},
               {'$ref': '#/definitions/PromptNodeComponent'},
               {'$ref': '#/definitions/PromptTemplateComponent'},
               {'$ref': '#/definitions/PseudoLabelGeneratorComponent'},
               {'$ref': '#/definitions/QuestionGeneratorComponent'},
               {'$ref': '#/definitions/RCIReaderComponent'},
               {'$ref': '#/definitions/RecentnessRankerComponent'},
               {'$ref': '#/definitions/RouteDocumentsComponent'},
               {'$ref': '#/definitions/SentenceTransformersRankerComponent'},
               {'$ref': '#/definitions/ShaperComponent'},
               {'$ref': '#/definitions/TableReaderComponent'},
               {'$ref': '#/definitions/TableTextRetrieverComponent'},
               {'$ref': '#/definitions/TextConverterComponent'},
               {'$ref': '#/definitions/TfidfRetrieverComponent'},
               {'$ref': '#/definitions/TikaConverterComponent'},
               {'$ref': '#/definitions/TopPSamplerComponent'},
               {'$ref': '#/definitions/TransformersDocumentClassifierComponent'},
               {'$ref': '#/definitions/TransformersDocumentLanguageClassifierComponent'},
               {'$ref': '#/definitions/TransformersImageToTextComponent'},
               {'$ref': '#/definitions/TransformersQueryClassifierComponent'},
               {'$ref': '#/definitions/TransformersReaderComponent'},
               {'$ref': '#/definitions/TransformersSummarizerComponent'},
               {'$ref': '#/definitions/TransformersTranslatorComponent'},
               {'$ref': '#/definitions/WebRetrieverComponent'},
               {'$ref': '#/definitions/WebSearchComponent'},
               {'$ref': '#/definitions/WhisperTranscriberComponent'}]}

On instance['components'][3]:
    {'name': 'NLI',
     'params': {'entailment_contradiction_threshold': 0.5,
                'model_name_or_path': 'microsoft/deberta-v2-xlarge-mnli',
                'use_gpu': True},
     'type': 'EntailmentChecker'}

  File "/home/dev/g3/g3_2/lib/python3.8/site-packages/haystack/nodes/base.py", line 121, in get_subclass
    raise PipelineSchemaError(
haystack.errors.PipelineSchemaError: Haystack component with the name 'EntailmentChecker' not found. Check the class name of your component for spelling mistakes and make sure you installed Haystack with the proper extras: https://docs.haystack.deepset.ai/docs/installation#custom-installation