Common-SenseMakers / sensemakers

Sensemakers infrastructure for developing AI-based tools for semantic annotations of social posts. Cross-poster app to publish your semantic posts on different networks.
GNU General Public License v3.0
1 stars 2 forks source link

Having issue with the MultiChanParser in the example JupiterNotebook #63

Closed ShaRefOh closed 4 months ago

ShaRefOh commented 4 months ago

I am running through the notebook multi_chain_example and this cell multi_chain_parser = MultiChainParser(config) raises the error:

2024-04-24 15:04:42.838 | INFO     | desci_sense.shared_functions.parsers.multi_chain_parser:__init__:64 - Initializing MultiChainParser. PostProcessType=combined
2024-04-24 15:04:42.852 | INFO     | desci_sense.shared_functions.parsers.multi_chain_parser:__init__:71 - Initializing post parsers...
2024-04-24 15:04:42.853 | INFO     | desci_sense.shared_functions.parsers.post_parser_chain:__init__:24 - Initializing parser chain 'refs_tagger' 
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?95e6720e-01cc-41f3-8011-eda567b4136e)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 multi_chain_parser = MultiChainParser(config)

File ~/sensemakers/nlp/notebooks/../desci_sense/shared_functions/parsers/multi_chain_parser.py:74, in MultiChainParser.__init__(self, config)
     72 self.pparsers = {}
     73 for pparser_config in config.parser_configs:
---> 74     self.pparsers[pparser_config.name] = parser_factory(
     75         pparser_config, config, self.ontology_base
     76     )
     78 # init parallel chain
     79 self.parallel_chain = self.create_parallel_chain(self.pparsers)

File ~/sensemakers/nlp/notebooks/../desci_sense/shared_functions/parsers/parser_factory.py:26, in parser_factory(pparser_config, multi_chain_config, ontology)
     20     pparser = KeywordPostParserChain(
     21         pparser_config,
     22         multi_chain_config,
     23         ontology,
     24     )
     25 elif pparser_type == ParserChainType.REFERENCE_TAGGER:
---> 26     pparser = ReferenceTaggerParserChain(
     27         pparser_config,
     28         multi_chain_config,
     29         ontology,
...
   4970         f"Expected a Runnable, callable or dict."
   4971         f"Instead got an unsupported type: {type(thing)}"
   4972     )

TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'desci_sense.shared_functions.postprocessing.output_processors.AllowedTermsParser'>

@ronentk can you look into that?

ronentk commented 4 months ago

hmm strange, can you share an exact example @ShaRefOh ? The code is working for me right now.

ShaRefOh commented 4 months ago

That's strange... Perhaps some dependencies issue?

ronentk commented 4 months ago

can you run pip freeze and share your env with me?

ShaRefOh commented 4 months ago

Sending env on Signal

ronentk commented 4 months ago

I think your requirements are from an older version. Try setting up a new environment by following these instructions https://github.com/Common-SenseMakers/sensemakers/tree/development/nlp#installation

(make sure you're on dev branch)