Skip to content

dgisolfi/LoRAG

Repository files navigation

LoRAG

CS7643 Final Project

Author(s)

Usage

Dependencies

python3 -m pip install -r requirements.txt

Training

A config file can be specified via the cli, the default is under the configs dir.

> python3 -m lorag --help                                 
usage: __main__.py [-h] [--config CONFIG] [--no-cache] [--grid-search]

LoRAG Experiment

options:
  -h, --help       show this help message and exit
  --config CONFIG  Path to YAML configuration file
  --no-cache       Force regenerate tokenized dataset and ignore cached version
  --grid-search    Drives a gridsearch rather than single model run

Experiments

Baseline for Model on dataset

python3 -m lorag --config .\configs\bioT5.yaml --no-cache

Apply LoRA

python3 -m lorag --config .\configs\bioT5_lora.yaml --no-cache

qLoRA

python3 -m lorag --config .\configs\bioT5_qlora.yaml --no-cache

Grid Search (Optuna Study)

python3 -m lorag --no-cache --grid-search

Plan / Dev Items for LoRA + RAG + Quantization ML pipeline

Create a data loader and preprocessor

Load a pretrained Model

Setup LoRA

  • Use the peft library to wrap the base transformer in a LoRA adapter.
  • Define a LoraConfig targeting key attention projection layers.
  • Convert the frozen base model into a PeftModel with trainable low-rank matrices.
  • Allow switching between baseline (no LoRA) and LoRA-enabled versions.

Train

  • We can start with the chosen model as a baseline for the performance on the task
  • Next we can use the best parameters found for the base model and then train with the PEFT model using LoRA.
  • If we can find LoRA configuration that improves the base model on the task we can keep that config for LoRA
  • Repeat for the quantization task?

Evaluation

  • Run on a Test set and track performance

Quantization

RAG (Retrieval-Augmented Generation)

  • Build a vector index from FAISS?
  • We can look into this later as the project is meant to revolve around the training.

Metrics

About

CS7643 Final Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •