Skip to content

Project of SJTU-CS3602 Natural Language Processing

Notifications You must be signed in to change notification settings

ccmoony/chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHENBOT Static Badge

CHENBOT is a simple chatbot with knowledge and warmth.

⚙️ Configuration

First, clone the repository and navigate to the project directory:

git clone https://github.com/ccmoony/chatbot
cd chatbot

Then, create a new conda environment and install the dependencies:

conda create -n chenbot python=3.10
conda activate chenbot
pip install -r requirements.txt

Download Qwen2.5-3B and put it in the root folder.

🚀 Fine-tuning

Make a new directory checkpoint and navigate to the sft directory

mkdir checkpoint
cd sft

Instruction-tuning

Run the following commands for instruction tuning using Alpaca-cleaned dataset:

python finetune.py

Run the following commands for instruction tuning using Alpaca-cleaned dataset with LoRA:

python finetune.py --use_lora

Style-tuning

Run the following commands to fine-tune the model with LoRA to imitate the tone of Zhen Huan:

python finetune.py --config config_huanhuan.yaml --style huanhuan --use_lora

Run the following commands to fine-tune the model with LoRA to imitate the tone of Sun Wukong:

python finetune.py --config config_sunwukong.yaml --style wukong --use_lora

Checkpoint

You can download our lora finetuned model from Here and put them in ../checkpoint folder.

📖 Retrieval-Augmented Generation

Run the following commands to use RAG in chatbot:

python chat.py --retrieval

💻 Deploy on Terminal

Run the following commands to start the chatbot on terminal. Use the pretrained model or the full-parameter fine-tuned model:

python chat.py --model_path "your_model_path"

Use the LoRA fine-tuned model:

python chat.py --model_path "your_model_path" --lora_path "your_lora_path"

Use the Zhen Huan styled model:

python chat.py --model_path "your_model_path" --lora_path "zhenhuan_style_lora_path" --style huanhuan

Use the Sun Wukong styled model:

python chat.py --model_path "your_model_path" --lora_path "wukong_style_lora_path" --style wukong

🎮 GUI Demo

Run the following command to start a Web UI demo(You may need to change the model path to your own path in demo.py):

python demo.py

The demo below will open in a browser on http://localhost:7860 UI

About

Project of SJTU-CS3602 Natural Language Processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages