YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

LoRA

LoRA (Low-Rank Adaptation) fine-tuning examples for BERT and Qwen2.5-7B-Instruct using PEFT and QLoRA.

Structure

  • bert/ โ€” LoRA fine-tuning of BERT-base for sentiment classification (Rotten Tomatoes)
  • qwen/ โ€” QLoRA fine-tuning of Qwen2.5-7B-Instruct for instruction following (Alpaca)
  • check_gpu.py โ€” GPU diagnostics script
  • main.py โ€” Entry point

Getting Started

Prerequisites

  • Python 3.14 (see .python-version)
  • NVIDIA GPU with โ‰ฅ12GB VRAM (for Qwen QLoRA training)

1. Install uv

curl -LsSf https://astral.sh/uv/install.sh | sh

Or via pip: pip install uv

2. Set up the environment

uv sync

This creates a virtual environment and installs all dependencies (torch, transformers, peft, jupyter, etc.) as defined in pyproject.toml and uv.lock.

3. Run training or inference scripts

# LoRA fine-tune BERT-base for sentiment classification
uv run python bert/train_lora.py

# Run inference with the trained BERT adapter
uv run python bert/inference.py

# QLoRA fine-tune Qwen2.5-7B-Instruct
uv run python qwen/train_lora.py

# Chat with the trained Qwen adapter
uv run python qwen/chat_qlora.py

# GPU diagnostics
uv run python check_gpu.py

4. Launch Jupyter Lab (to explore notebooks)

uv run jupyter lab

Then open qwen/lora_explained.ipynb or bert/lora_explained.ipynb in the browser.

Author

Siwen Yu (yusiwen@gmail.com)

License

MIT

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support