This repository contains the implementation of RuleGPT from the paper titled "HORAE: A Domain-Agnostic Language for Automated Service Regulation" accepted by IJCAI 2025 (AI4Tech). The repository instructs how one can quickly train and deploy RuleGPT.
We also open-source dataset SRR-Eval for fine-tuning RuleGPT as well as the so-obtained model weights.
Below, we provide details about the usage of scripts for supervised fine-tuning RuleGPT with LLaMA-Factory.
Before you start, make sure you have installed the following packages:
- Follow the instructions of LLaMA-Factory, and build the environment.
- Install these packages:
pip install deepspeed
pip install flash-attn --no-build-isolation
- If you want to use FlashAttention-2, make sure your CUDA is 11.6 and above.
LLaMA-Factory provides several training datasets in data folder, you can use it directly. If you want use SRR-Eval, download the dataset from huggingface and save it to data_process folder.
Execute the following training command:
llamafactory-cli train qwen2_5-7b-lora-sft.yaml
and enjoy the training process. To make changes to your training, you can modify qwen2_5-7b-lora-sft.yaml.
Run the following command to perform the merging of LoRA adapters.
llamafactory-cli train qwen2_5-7b-merge-lora.yaml
In infer folder, we provide code to either use your local model RuleGPT or other commercial models to get your inference results.
Run python infer_local.py to get your RuleGPT results. Run python infer_gpt.py to get other models results.
The above instructions give a simple way to train and deploy RuleGPT via LLaMA-Factory. Feel free to dive into the details by checking the official repo!