Prerequisites
Before installing NL2FOL, ensure you have the following:Python 3.7+
Python 3.7 or higher is required
CUDA (Optional)
NVIDIA GPU with CUDA for faster inference
CVC4/CVC5
SMT solver binary for logical verification
OpenAI API Key
Required if using GPT models
Clone the Repository
First, clone the NL2FOL repository:Install Python Dependencies
The project requires several key dependencies for LLM inference, transformers, and SMT solving.Core Dependencies
Install all required packages using the provided requirements file:Key Packages
The main dependencies include:Deep Learning & NLP
Deep Learning & NLP
- transformers (v4.33.3): Hugging Face transformers library for LLM access
- torch (v2.4.1): PyTorch for model inference
- torchvision (v0.19.1): Vision utilities
- accelerate (v1.0.1): Distributed training and inference
- tokenizers: Fast tokenization
- sacremoses: Text preprocessing
API & External Services
API & External Services
- openai (v1.52.0): OpenAI API client for GPT models
- httpx (v0.27.2): Modern HTTP client
- requests: HTTP library for API calls
Data Processing
Data Processing
- pandas: DataFrame operations for dataset handling
- numpy: Numerical computing
- scikit-learn: Metrics calculation (via joblib)
Utilities
Utilities
- pydantic (v2.9.2): Data validation
- tqdm: Progress bars
- click: CLI argument parsing
The requirements.txt includes many conda-built packages. If you encounter issues, consider using a conda environment or removing the file path references from the requirements.
Install SMT Solver
The project uses CVC4 or CVC5 for SMT solving. Download and install the solver:CVC4 Installation
CVC5 Installation (Alternative)
Set Up OpenAI API Key
If you plan to use GPT models, configure your OpenAI API key:Verify GPU Access (Optional)
If using a GPU, verify CUDA availability:Directory Structure
After installation, ensure your directory structure looks like this:Create Output Directories
Create necessary directories for storing results:The SMT output directories will be created automatically when running the pipeline.
Troubleshooting
Import errors for transformers
Import errors for transformers
Ensure you have the correct version:
CUDA out of memory
CUDA out of memory
Reduce batch size or use CPU inference:
CVC4 not found
CVC4 not found
Verify the binary path matches the code:
OpenAI API errors
OpenAI API errors
Verify your API key is set:
Next Steps
Quick Start Guide
Learn how to run your first logical fallacy detection
