https://github.com/reprompts/lightchat
LightChat is a lightweight GPT-2–based toolkit built on top of DistilGPT2. It enables anyone to train, deploy, and interact with a custom chatbot on low‑end devices using simple CLI commands
https://github.com/reprompts/lightchat
ai artificial-intelligence artificial-neural-networks beginner-friendly chatbot chatbots chatgpt chatgpt-api gpt machine-learning machinelearning open-source pip pypi python python3
Last synced: 7 months ago
JSON representation
LightChat is a lightweight GPT-2–based toolkit built on top of DistilGPT2. It enables anyone to train, deploy, and interact with a custom chatbot on low‑end devices using simple CLI commands
- Host: GitHub
- URL: https://github.com/reprompts/lightchat
- Owner: Reprompts
- License: mit
- Created: 2025-05-07T18:16:14.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-05-09T07:47:12.000Z (7 months ago)
- Last Synced: 2025-05-09T08:38:31.549Z (7 months ago)
- Topics: ai, artificial-intelligence, artificial-neural-networks, beginner-friendly, chatbot, chatbots, chatgpt, chatgpt-api, gpt, machine-learning, machinelearning, open-source, pip, pypi, python, python3
- Language: Python
- Homepage: https://pypi.org/project/lightchat/
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# LightChat

LightChat is a lightweight GPT-2–based toolkit built on top of DistilGPT2. It enables anyone to train, deploy, and interact with a custom chatbot on low‑end devices using simple CLI commands.
## 🌐 Links & Community
- 🔗 GitHub Repository: [github.com/reprompts/lightchat](https://github.com/reprompts/lightchat)
- 💼 LinkedIn Group: [LightChat Dev Group](https://www.linkedin.com/groups/14631875/)
- 📰 Dev.to Profile: [@repromptsquest](https://dev.to/repromptsquest)
- 🐦 Twitter: [@repromptsquest](https://twitter.com/repromptsquest)
---
## 🔧 Features
* **Train** your own language model on plain text files
* **Chat** interactively with your fine‑tuned model
* **List** & **delete** saved models
* Supports **top‑k** and **top‑p** (nucleus) sampling
---
## 📋 Dataset Preparation
* Provide a **plain text** file (`.txt`) with **one sentence per line**.
* Aim for at least **1,000–10,000 lines** for reasonable results on CPU.
* Clean, focused content yields better chat relevance.
**Example** (`data.txt`):
```
Hello, how can I help you today?
I love reading sci‑fi novels.
What's the weather like?
```
---
## ⚙️ Installation
```bash
pip install lightchat
```
> **⚠️ CPU install note:** Transformers and PyTorch may take several minutes to compile on CPU.
---
## 🚀 Training
```bash
lightchat train \
--epochs 3 \
--batch-size 8 \
--learning-rate 5e-5
Example Command:
lightchat train newmodel data.txt --epochs 1 --batch-size 8 --learning-rate 5e-5
> **⚠️ Data file path :** Give proper path to the dataset or keep dataset inside the root directory of project where library is installed.
```
* **model\_name**: directory under `models/` to save to
* **epochs**: full passes over your data
* **batch-size**: number of samples per step
* **learning-rate**: step size for optimizer
> **⚠️ CPU training note:** Training on CPU is slow. More epochs/bigger batch sizes = longer time but better fit.
---
## 💬 Chatting
```bash
lightchat chat \
--max-length 100 \
--top-k 50 \
--top-p 0.9 \
--temperature 1.0
Example Command:
lightchat chat newmodel --max-length 100 --top-k 50 --temperature 0.9
```
* **max-length**: max generated tokens per reply
* **top-k**: sample from top *k* tokens
* **top-p**: sample from top cumulative probability *p*
* **temperature**: randomness control (higher = more creative)
Give "exit" as an prompt to the model to exit the conversation and you can load the trained models anytime by following the instructions given below.
> Trained models live in `models//`.
---
## 📂 Model Management
* **List** saved models: `lightchat list-models`
* **Delete** a model: `lightchat delete-model `
* Or manually remove `models//` directory.
---
## 🙌 Contributions
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md).