ChatGLM-Efficient-Tuning  by hiyouga

Fine-tuning tool for ChatGLM-6B

created 2 years ago
3,712 stars

Top 13.3% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides an efficient framework for fine-tuning the ChatGLM-6B language model using Parameter-Efficient Fine-Tuning (PEFT) techniques. It targets researchers and developers looking to adapt ChatGLM for specific tasks or datasets with reduced computational resources. The primary benefit is enabling effective fine-tuning on consumer-grade hardware.

How It Works

The framework leverages Hugging Face's PEFT library to implement various efficient fine-tuning methods, including LoRA, P-Tuning V2, Freeze, and Full Tuning. It supports supervised fine-tuning (SFT), reward modeling (RM), and Reinforcement Learning from Human Feedback (RLHF). The approach dynamically pads inputs to the longest sequence in a batch, accelerating training compared to padding to a fixed maximum length.

Quick Start & Requirements

  • Install: pip install -r requirements.txt
  • Prerequisites: Python 3.8+, PyTorch 1.13.1+, Transformers, Datasets, Accelerate, PEFT, TRL, fire, protobuf, cpm-kernels, sentencepiece, jieba, rouge-chinese, nltk, gradio, matplotlib, uvicorn, fastapi, sse-starlette. Requires powerful GPUs.
  • Setup: Clone repo, create conda env, install requirements.
  • Web UI: CUDA_VISIBLE_DEVICES=0 python src/train_web.py (single GPU only)
  • Docs: Wiki

Highlighted Details

  • Supports 4-bit LoRA (QLoRA) training.
  • Offers an all-in-one Web UI for training, evaluation, and inference.
  • Aligns demo API with OpenAI's format.
  • Supports fine-tuning ChatGLM2-6B.
  • Enables training with combined datasets and from checkpoints.
  • Provides evaluation metrics (BLEU, ROUGE).

Maintenance & Community

This repository will not be maintained in the future. Users are directed to follow LLaMA-Factory for continued development.

Licensing & Compatibility

Apache-2.0 License. Users must also adhere to the ChatGLM-6B model license. Compatible with commercial use, provided the ChatGLM model license is respected.

Limitations & Caveats

The project is no longer actively maintained. The Web UI currently only supports single-GPU training. Windows users may need a specific bitsandbytes installation for QLoRA.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
29 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.