LoRe has a minimal dependency footprint: a standard Python scientific stack plus PyTorch and Hugging Face Transformers. The only hardware requirement for training is a reasonably modern CUDA GPU; embedding extraction additionally requires enough VRAM to host the Skywork reward model backbone (~16 GB inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facebookresearch/LoRe/llms.txt
Use this file to discover all available pages before exploring further.
bfloat16).
Requirements
| Requirement | Minimum version | Notes |
|---|---|---|
| Python | 3.8 | 3.10+ recommended |
| PyTorch | 2.3.0 | Must match your CUDA version |
| CUDA GPU | Any CUDA-capable device | Required for embedding generation; strongly recommended for training |
| Flash Attention 2 | Latest | Required by prepare.py for RedditTLDR and PersonalLLM |
Installing dependencies
Clone the repository, then install all pinned dependencies fromrequirements.txt:
requirements.txt
LoRe is not distributed as an installable Python package. All scripts import
utils.py by appending the repository root to sys.path at runtime, so you do not need to run pip install -e . or any equivalent.GPU and Flash Attention 2
Embedding extraction (prepare.py) loads Skywork/Skywork-Reward-Llama-3.1-8B-v0.2 — an 8B parameter model that requires approximately 16 GB VRAM when loaded in bfloat16. This step is mandatory for the RedditTLDR and PersonalLLM datasets and uses attn_implementation="flash_attention_2" for efficient inference.
The train_basis.py scripts also load the reward model backbone to extract the pretrained linear head weights as the reference vector V_final. A GPU is strongly recommended for training but is not strictly required for small K values.
Project structure
After cloning, the repository has the following layout:utils.py at the root. Dataset-specific scripts import from it using:
Verify the installation
After installing dependencies, confirm the core imports work:utils.py is importable from a dataset subdirectory by running the following from, for example, RedditTLDR/:
Environment recommendations
Using a virtual environment
Using a virtual environment
It is recommended to install LoRe dependencies into an isolated environment to avoid conflicts with other PyTorch projects:
Using conda
Using conda
requirements.txt to ensure CUDA toolkit compatibility.Matching PyTorch and CUDA versions
Matching PyTorch and CUDA versions
requirements.txt pins torch==2.3.0, which was built against CUDA 11.8 and 12.1. If your system CUDA version differs, install a compatible PyTorch build from pytorch.org before running pip install -r requirements.txt, and skip the torch line in requirements.txt if needed.