A lightweight AI text generator based on distilgpt2. You can generate text using a pre-trained model and fine-tune it on your own dataset.
git clone https://github.com/yourusername/TinyGPT.git
cd TinyGPTpython3 -m venv ai_env
source ai_env/bin/activate # on mac/linux
ai_env\Scripts\activate # on windows powershellpip install -r requirements.txtRun TinyGPT with a prompt:
python src/tinygpt.pyModify the prompt inside src/tinygpt.py to experiment with different outputs.
If you want to fine-tune the model on your own dataset (data/data.txt):
python src/fine_tune.pyThis will train the model and save it in models/fine_tuned_model/
After fine-tuning, update tinygpt.py to load the fine-tuned model:
# change model path to fine-tuned version
generator = pipeline("text-generation", model="../models/fine_tuned_model")Then, run:
python src/tinygpt.py- The
data/data.txtfile should contain training examples in plain text format. - Model weights are not included here but will be downloaded automatically.