🧠 My Fine-Tuned Local Chatbot

A locally hosted AI chatbot powered by a fine-tuned DistilGPT2 model using Hugging Face Transformers. This chatbot is trained on the Stanford Alpaca Instruction Dataset, enabling it to follow instructions and provide helpful responses β€” all without relying on internet access.


πŸš€ Features

  • πŸ”’ Fully local – no internet required after setup
  • 🧠 Fine-tuned on Stanford Alpaca-style instructions
  • ⚑ Fast inference with CUDA or CPU fallback
  • 🌐 Flask API with simple HTML/CSS/JavaScript frontend
  • 🎨 Customizable prompts and response formatting
  • 🧾 Chat history saved using SQLite
  • Dataset Used: Stanford Alpaca

πŸ“‚ Project Structure

β”œβ”€β”€ app.py # Flask API backend
β”œβ”€β”€ train.py # Script for fine-tuning the model
β”œβ”€β”€ chatbot_model/
β”‚ └── trained_model_* # Your fine-tuned model directory
β”œβ”€β”€ static/
β”‚ β”œβ”€β”€ styles.css # Frontend styles
β”‚ └── script.js
β”œβ”€β”€ templates/
β”‚ └── index.html # Web UI
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md # You are here!
β”œβ”€β”€ download.py
β”œβ”€β”€ preprocess.py
β”œβ”€β”€ int_db.py
β”œβ”€β”€ chat_history.db # Saves history of chats
└── processed_dataset.csv

Demo

image/png


πŸ’‘ Sample Prompt

Human: What is the capital of France?
Assistant: The capital of France is Paris.


πŸ‹οΈβ€β™€οΈ Training

python train.py

This will:

Download the Stanford Alpaca dataset

Fine-tune distilgpt2

Save it inside: chatbot_model/trained_model_YYYYMMDD_HHMMSS/


πŸ–₯️ Run the App

python app.py

Then visit: http://localhost:5005


❓ FAQ

Q: Does this work offline? βœ… Yes! Once the model is fine-tuned, no internet is needed.

Q: Can I run it on CPU? βœ… Yes, but it will be slower. A CUDA GPU is recommended for faster responses.

Q: Can I replace the model? βœ… Yes! You can fine-tune any Hugging Face-compatible model by modifying train.py.


πŸ› οΈ Tech Stack

  • Flask – Web server backend
  • Transformers – Hugging Face inference
  • PyTorch – Deep learning engine
  • HTML/CSS/JavaScript – Frontend
  • Stanford Alpaca Dataset
  • SQLite – For saving chat history
  • Python

πŸ“œ License

MIT License – Free to use, modify, and share.


πŸ‘©β€πŸ’» Author

Jasleen Kaur Matharoo
πŸ“§ [email protected]
🌐 GitHub @Jasleen-05

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

Model tree for Jasleen05/my-local-chatbot

Finetuned
(836)
this model

Dataset used to train Jasleen05/my-local-chatbot