ChatGLM-Efficient-Tuning  by hiyouga

Fine-tuning tool for ChatGLM-6B

Created 2 years ago
3,714 stars

Top 13.0% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
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

Inactive

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

Explore Similar Projects

Starred by Casper Hansen Casper Hansen(Author of AutoAWQ), Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), and
5 more.

xtuner by InternLM

0.5%
5k
LLM fine-tuning toolkit for research
Created 2 years ago
Updated 1 day ago
Starred by Tony Lee Tony Lee(Author of HELM; Research Engineer at Meta), Lysandre Debut Lysandre Debut(Chief Open-Source Officer at Hugging Face), and
24 more.

LLaMA-Factory by hiyouga

1.1%
58k
Unified fine-tuning tool for 100+ LLMs & VLMs (ACL 2024)
Created 2 years ago
Updated 2 days ago
Feedback? Help us improve.