CS7643 Final Project
- Daniel Nicolas Gisolfi dgisolfi3@gatech.edu
- Kaushal Gandikota kgandikota6@gatech.edu
python3 -m pip install -r requirements.txt
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
python3 -m lorag --config .\configs\bioT5.yaml --no-cache
python3 -m lorag --config .\configs\bioT5_lora.yaml --no-cache
python3 -m lorag --config .\configs\bioT5_qlora.yaml --no-cache
python3 -m lorag --no-cache --grid-search
- Setup a hugging face or a custom datset
- Format the dataset into a Q&A format ( unless we change the input data type )
- dataset: https://huggingface.co/datasets/Mreeb/Dermatology-Question-Answer-Dataset-For-Fine-Tuning
- Tokenize the data for the model
- For the hugging face models we can use the AutoTokenizer the
transformerspackage to grab the right tokenizer for the chosen model - https://huggingface.co/docs/transformers/v4.57.3/en/model_doc/auto#transformers.AutoTokenizer
- For the hugging face models we can use the AutoTokenizer the
-
We can use the
transformerspackage to load BERT and other pretrained models like BioBERT with the AutoModel class -
We can also configure the model for classification with the many subclasses for tasks like: https://huggingface.co/docs/transformers/v4.57.3/en/model_doc/auto#transformers.AutoModelForSequenceClassification
- Use the
peftlibrary to wrap the base transformer in a LoRA adapter. - Define a
LoraConfigtargeting key attention projection layers. - Convert the frozen base model into a
PeftModelwith trainable low-rank matrices. - Allow switching between baseline (no LoRA) and LoRA-enabled versions.
- 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?
- Run on a Test set and track performance
- We can use F1/accuracy metrics to start
- Also there are benchmarks on hugging face we can add to show improvemnts
- A bert specific metric: https://huggingface.co/papers/1904.09675
- We can use the BitsAndBytesConfig from peft to apply floating point or int quantization
- We can then evaluate the size of the model reduction and any other changes by running the baseline and with/without LoRA applied
- Build a vector index from FAISS?
- We can look into this later as the project is meant to revolve around the training.