Downloads · 30 days
0
tekkonetes/tyo-gpt2
tyo-gpt2 is a machine learning model from tekkonetes. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A very simple script on how to train a GPT model with just a text file. Created by @Tekkonetes (Hugging Face) or @pxlmastrXD (Replit).
Downloads · 30 days
0
Access
Public
Updated Apr 4, 2023
Repo size
—
Likes
1
Public
Click a slice to open those files.
.py2.3 KB · 48%
From the Hugging Face model README
A very simple script on how to train a GPT model with just a text file. Created by @Tekkonetes (Hugging Face) or @pxlmastrXD (Replit).
You will need some packages installed to run this. Make sure you have a recent (supported) python version, and then install some packages. I would recommend using a Virtual environment to do this, so you can remove it easily after training and deployment:
python -m venv venv
source venv/bin/activate
Then, install some required packages:
pip install transformers numpy torch
That should be all you need.
First, put all your data into the train.txt file. By tweaking the code, you can use multiple.
Second, select your GPT model. By default, the script uses gpt2-medium, but you can replace it with most GPT-based models.
You might have to do some tweaking, however.
Then, run the script.
python main.py
That is pretty much it. Feel free to use this for whatever you want!!!