ChatGLM-finetune-LoRA  by lich99

LoRA finetuning code for ChatGLM-6b

created 2 years ago
719 stars

Top 48.8% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides code for fine-tuning the ChatGLM-6b language model using Low-Rank Adaptation (LoRA). It targets researchers and developers looking to efficiently adapt large language models for specific tasks with reduced computational resources. The primary benefit is enabling fine-tuning on consumer-grade hardware, specifically mentioning an RTX 3090 with 24GB of GPU memory.

How It Works

The project leverages the LoRA technique, which injects trainable low-rank matrices into the existing model weights. This significantly reduces the number of trainable parameters (0.35% in the example) compared to full fine-tuning, leading to faster convergence and lower memory requirements. The code integrates with Hugging Face's transformers library and uses accelerate for multi-GPU and DeepSpeed-accelerated training, supporting ZeRO 2 and ZeRO 3 optimizations.

Quick Start & Requirements

  • Install/Run: Use accelerate launch for training.
  • Prerequisites: Python, PyTorch, transformers, loralib, accelerate, deepspeed. Minimum 24GB GPU memory (RTX 3090 recommended).
  • Data Format: JSON list of {'prompt': ..., 'completion': ...} pairs.
  • Docs: README

Highlighted Details

  • Supports fine-tuning the entire model for potentially better performance.
  • Includes options for multi-GPU training and DeepSpeed integration.
  • Provides example data formatting and training loss curve visualization.
  • Demonstrates saving and loading LoRA weights.

Maintenance & Community

The repository was last updated around April 2022. There is no explicit mention of active community channels or ongoing maintenance.

Licensing & Compatibility

The repository does not explicitly state a license. The code uses libraries with various licenses (e.g., Hugging Face transformers typically uses Apache 2.0). Users should verify compatibility for commercial or closed-source use.

Limitations & Caveats

The project appears to be from early 2022, and the ChatGLM-6b model itself might have been superseded. The lack of explicit licensing and recent activity could indicate limited ongoing support or potential compatibility issues with newer library versions.

Health Check
Last commit

2 years ago

Responsiveness

1 day

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

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Ying Sheng Ying Sheng(Author of SGLang), and
9 more.

alpaca-lora by tloen

0.0%
19k
LoRA fine-tuning for LLaMA
created 2 years ago
updated 1 year ago
Feedback? Help us improve.