CMU Advanced NLP Assignment 2: End-to-end NLP System Building
This repository contains a Retrieval-Augmented Generation (RAG) system to answer questions about Pittsburgh and Carnegie Mellon University.
data/- raw and processed data (HTML, PDFs, chunked JSONL, test set)src/- source codecrawler/- scrapers and chunkersretriever/- BM25, dense, hybrid retrievalreader/- QA models and RAG pipelineutils/- helper functions
notebooks/- optional exploratory notebookstests/- unit testsrequirements.txt/environment.yml- dependencies
# Using pip
pip install -r requirements.txt
# Using conda
conda env create -n rag_env python=3.10
conda activate rag_envcurl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull qwen2.5:32b
ollama pull llama3.2:3b# CPU-only version
$ conda install -c pytorch faiss-cpu=1.12.0
# GPU(+CPU) version
$ conda install -c pytorch -c nvidia faiss-gpu=1.12.0
# GPU(+CPU) version with NVIDIA cuVS
$ conda install -c pytorch -c nvidia -c rapidsai -c conda-forge libnvjitlink faiss-gpu-cuvs=1.12.0
# GPU(+CPU) version using AMD ROCm not yet availablecd src/retriever/chunk.py
python chunk.py all_html5.json # The chunk will be stored in the retriever folderpython rag.py
🔧 Building Dense index ...
🔁 Computing embeddings ...
⚡ FAISS index built with 61930 vectors (dim=768)
Dense meta + FAISS saved to src/retriever/indexes