Coder Social home page Coder Social logo

twitterbot's Introduction

TwitterBot

Automatised synthetic tweet generation from a real twitter handle.

The bot can be trained generating synthetic data from well known twitter user (DonaldTrum, ...) or alternatively, real twitter data can be used.

TwitterBot:

  • mymics the twitterer's style
  • is trained to run casual conversations
  • is capable of relating information found in older tweets and integrate this in its responses

Run

update config.yaml and run:

python api.py

It will run on http://127.0.0.1:5000. Open that url and your browser.

To generate tweets, enter generate a random tweet from {twitter_handle}, with twitter_handle that is for instance the realDonaldTrump or alternatively just send an empy string (keep prompt on webpage empty en click send).

To generate retweets, enter random tweets the agent should be answering/retweeting to.

Requirements

One needs:

  • openai key to generate the synthetic data and twitter secret token, access key and so on to download twitter data to built a twitterbot from it.
  • deeplake key as the cloud based technology to build the agent memory as knowledge base built with the historical tweets.

Configuration

Meta data and parameters to run all functionalities of TwitterBot ./config.yaml

Installation

Use the standard requirements.txt file.

Alternatively, installing the libraries below should be enough: pip install --upgrade openai pip install names pip install PyYAML pip install langchain pip install flask pip install sentence_transformers pip install tqdm pip install pickle5 pip install deeplake

Scripts

The model are built through the following scripts.

Generate And Massage Twitter Data

Two modes are supported:

  1. Mock Twitter Data Use a wellknown twitter handle in the config file and run:

bash script_generate_mock_tweets.sh

  1. Download Real Twitter Data This workflow has never been tested and is expected to require slight adjustments:

bash script_download_and_preprocess_twitter_data.sh

Prepare Data and Train Model

Allows to get fine_tune_job_id

bash script_prepare_data_and_train_model.sh

Monitor Model

Requires fine_tune_job_id in config.

bash script_monitor_openai_agent.sh

Training is over when all training epochs have been ran and model gets a "fine_tuned_model" name.

twitterbot's People

Contributors

gilgameshjw avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.