snap-stanford / GreaseLM

[ICLR 2022 spotlight]GreaseLM: Graph REASoning Enhanced Language Models for Question Answering
MIT License
228 stars 40 forks source link

retrieve graph for single sentence input #9

Closed kaiiwoo closed 2 years ago

kaiiwoo commented 2 years ago

Hi, thank you for introducing such an intriguing work.

your proposed sub graph retrieval process is customized to Q-A pair input.

What kinds of code snippets should I modify to retrieve a graph for just a single sentence input?

The reason why I ask is that I'd like to make a custom pipeline that samples ConceptNet's subgraph for given custom string input.

XikunZhang commented 2 years ago

In the preprocess.py script, I define a conversion function for each dataset to convert the original dataset format into an entailment format (essentially a Q-A pair -> a single declarative sentence). See here and here.

You want to write a customized conversion function for your dataset. You can refer to the conversion functions of csqa and obqa.