Skip to main content

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:
  • 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
  • openai (v1.52.0): OpenAI API client for GPT models
  • httpx (v0.27.2): Modern HTTP client
  • requests: HTTP library for API calls
  • pandas: DataFrame operations for dataset handling
  • numpy: Numerical computing
  • scikit-learn: Metrics calculation (via joblib)
  • 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)

The code references ./cvc4 in src/fol_to_cvc.py:24. Ensure the binary is named correctly or update the path in the code.

Set Up OpenAI API Key

If you plan to use GPT models, configure your OpenAI API key:
Or add it to your shell profile:

Verify GPU Access (Optional)

If using a GPU, verify CUDA availability:
Expected output:

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

Ensure you have the correct version:
Reduce batch size or use CPU inference:
Verify the binary path matches the code:
Verify your API key is set:

Next Steps

Quick Start Guide

Learn how to run your first logical fallacy detection