This repository contains a demo application and supporting tools for retrieving and inferring facts from the WebQSP dataset using a graph-based approach.
To set up the environment, use the provided environment.yml file. This ensures all dependencies are installed:
conda env create -f environment.yml
conda activate g_retriever_mYou can then run any of the scripts within the g_retriever_m folder.
The application relies on Ollama for LLM inference.
- Install Ollama: Run the provided installation script:
bash scripts/get_ollama.sh- Download the required LLM model:
ollama pull llama3.2:3bThis will download the correct LLM (Llama 3.2 3B) for use by the application.
- Generate an access token: https://huggingface.co/docs/hub/en/security-tokens.
- Add your token to the code file /g_retriever_m/.env as follows:
HF_TOKEN=YOUR_TOKENTo launch the interactive demo app, run:
python g_retriever_m/app.pyThis starts the main application interface.
To use the application, download the dataset folder from the following link:
Then, place the dataset into the following folder structure (note when cloning the repository, the old `g_retriever_m/dataset/' folder is still incomplete. Therefore, the downloaded dataset folder should replace the old one.):
g_retriever_m/dataset/
Make sure the contents of the dataset are directly inside the webqsp folder.
You can test the retriever manually (without the interface) using infer_sample.py. Here's an example command:
python g_retriever_m/infer_sample.py --query "Give me an interesting fact about frank ocean" --dataset webqsp --sample_idx 0 --seed 1app.py: Entry point for the demo app.graph_app_data.py: Contains helper functions to create graph data used by the app.infer_sample.py: Used for manual testing. Includes helper functions for inference.api_utils.py: Contains utility functions for easing inference in the app.api_retriever.py: A API interface for model inference, used for faster execution on systems like Snellius.