This repository contains code to train a Generative Pretrained Transformer (GPT) model from scratch. Using this code, you can train your own small chatbot similar to ChatGPT for your application or use case.
Please note, this is for learning purposes only, as training a fully-fledged LLM requires substantial computational resources and data.
- Create a virtual environment:
pyenv virtualenv 3.10.12 <env_name>
- Activate the virtual environment:
pyenv activate <env_name>
- Install the required packages:
pip install -r requirements.txt
- Create Data for pretraining
$ python src-llm/run.py -c data_prep
- Pretraining a foundation model
$ python src-llm/run.py -c pretrain_and_save
- if you want to just run the code and donot wish to save the model run the following cmd
$ python src-llm/run.py -c pretrain
- Test the Pretrained model.
- update the model in app.py
$ streamlit run src-llm/app.py
- Create Data for pretraining
$ python src-llm/run.py -c data_prep_ft
- Finetune the Pretrained model
$ python src-llm/run.py -c finetune_and_save
- if you want to just run the code and donot wish to save the model run the following cmd
$ python src-llm/run.py -c finetune
- Test the Pretrained model.
- update the model in app.py
$ streamlit run src-llm/app.py
This project is intended for learning purposes. Training a production-level LLM requires extensive computational power and data. Please conduct thorough research before implementing this in any production environment.
If you encounter any issues or wish to contribute, please reach out. I'd be happy to collaborate.