Skip to content

Latest commit

 

History

History
 
 

model

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

LawBot - Model

💻 Getting Started

⚠️ How To install Requirements

Cuda install

  1. Run the following code on your terminal.
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
chmod +x cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run
  1. Input accept to proceed.
Screenshot 2023-07-17 at 9 26 12 PM
  1. Select the driver and install.
Screenshot 2023-07-17 at 9 26 25 PM
  1. Run the following commands on your terminal.
$ export PATH=/usr/local/cuda-11.8/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
$ pip install -r requirements.txt

⌨️ How To Train

LLM (Large Language Model)

  • Before training, place Legal QA data at following directory
    model/LLM/train/data
    model/LLM/train/val_data
  • HuggingFace Write Token should be filled at line #38 of the following file
  • Run the following command on your terminal
$ python3 model/LLM/train/train.py

Question Filterering Model (Koelectra)

$ python3 model/Filter/train.py

⌨️ How To Infer

LLM (Large Language Model)

  • peft model id should be changed after training at line #27 of the following file
  • Run the following command on your terminal
$ python3 model/LLM/inference/infer.py

Sentence BERT Retrieval

  • Before training, place Legal QA data at following directory
    model/Retrieval/bert_retrieval/data
  • Run the following command on your terminal
$ python3 model/Retrieval/bert_retrieval/retrieval_main.py

BM25 Retrieval

  • Before training, place Legal QA data at following directory
    model/Retrieval/bm25_retrieval/all_data
  • Run the following command on your terminal
$ python3 model/Retrieval/bm25_retrieval/retrieval_main.py

Question Filtering Model (Koelectra)

  • Run the following command on your terminal
$ python3 model/Filter/infer.py

⌨️ How To Evaluate

LLM (Large Language Model)

  • model name and use parmater should be changed if needed
  • Run the following command on your terminal
$ python3 model/LLM/evaluation/evaluate_metrics.py