Skip to content

About

This repository is exclusively for the Large Language Models course from RUG (WBAI068-05, 2024-2025), which will be a informal-to-formal style transfer task

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

79 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM-Group-04

This repository is exclusively for the Large Language Models course from RUG (WBAI068-05, 2024-2025), which will be a informal-to-formal style transfer task

How to run the project

Create a python package manager (python environment) by typing python -m venv <directory> in your terminal, where directory is the name of the folder you want to give to your package manager. A popular option is to call it "venv".

To activate, type source <directory>/bin/activate if in linux or macOS or

# In cmd.exe
venv\Scripts\activate.bat
# In PowerShell
venv\Scripts\Activate.ps1

if in windows.

To install all the requirements type pip install -r requirements.txt. However, for the usage of LoRA you will need to install the package from the source. To do so, type

!pip install -q git+https://github.com/huggingface/peft

Running the preprocessing

To run the tokenisation

!python src/data_processing/loading_tokenization.py

This will output three files in the data/processed folder: test.pkl, train.pkl, and tune.pkl. Besides, we will also save the tokeniser in models/tokeniser/tokeniser.pkl.

Running the non-peft finetuning

To run the non-parameter efficient finetuning

!python src/models/finetuning.py

This will create a folder in src/models: fulldataset_FT_model, containing the files needed to load in the model and tokeniser.

Running the LoRA (parameter efficient) finetuning

To run the parameter efficient finetuning, run all cells in this notebook

!python src/models/LoRA_peft_finetuning.ipynb

This will create three folders in src/models: lora_trained, base_model and trained_tokenizer containing the files needed to load in the base model, the finetuned model and tokeniser.

Running the streamlit demo

To run the streamlit demo

streamlit run streamlit_demo.py

This will open a local server containing the streamlit demo. For more info visit the streamlit forums on https://docs.streamlit.io/

Running the Formality Classifier

To tun the Formality Classifier

!python src/utils/Formality_Classification.py

This will import the USE embeddings and then run a cross validation with grid search for the Formality Classifier, while saving the hyper-parameters of the best model

Running the evaluation of the non-peft model

To tun the evaluation

!python src/tests/eval_model.py

About

This repository is exclusively for the Large Language Models course from RUG (WBAI068-05, 2024-2025), which will be a informal-to-formal style transfer task

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages