Skip to content

discus0434/tweetgen-from-timeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tweet Generator Learning from Timeline, Powered by GPT-2-JA

Twitter Follow

Can easily generate tweets by GPT-2 Japanese model finetuned by your timeline.

Installation

1. Clone this repository

git clone https://github.com/discus0434/tweetgen-from-timeline.git
cd tweetgen-from-timeline

2. Install dependencies

pip

pip install -r requirements.txt

conda

conda create -n tweetgen python=3.9
echo "source activate tweetgen" > ~/.bashrc
conda run -n tweetgen pip install -r requirements.txt

...or build docker image

docker build tweetgen-from-timeline/. -t tweetgen-from-timeline
docker run -it --runtime=nvidia -d --restart=always tweetgen-from-timeline:latest bash

3. Arrange Twitter API tokens

Arrange .env file in the project directory. .env file should look like this:

API_KEY = XXX
API_SECRET_KEY = XXX
BEARER_TOKEN = XXX
ACCESS_TOKEN = XXX
ACCESS_TOKEN_SECRET = XXX

Usage

All you need is write a command below:

python main.py & disown

In addition, you can modify the number of tweets and fine-tuning per day to change values of NUM_UPDATE_PER_DAY and NUM_TWEETS_PER_DAY in main.py.

For example, if you want to make tweets per 30min:

NUM_TWEETS_PER_DAY = 48 # 86400 / 1800 = 48

do fine-tuning per hour:

NUM_UPDATE_PER_DAY = 24

Acknowledgements

This code borrows from transformers.

About

Scripts easily generate tweets by GPT-2 Japanese model fine-tuned by your timeline.

Topics

Resources

Stars

Watchers

Forks