All Projects → TheProtaganist → gpt-j

TheProtaganist / gpt-j

Licence: MIT license
A GPT-J API to use with python3 to generate text, blogs, code, and more

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to gpt-j

gpt-neo-fine-tuning-example
Fine-Tune EleutherAI GPT-Neo And GPT-J-6B To Generate Netflix Movie Descriptions Using Hugginface And DeepSpeed
Stars: ✭ 157 (+55.45%)
Mutual labels:  gpt-3, gpt-neo-text-generation, gpt-j
gpt-j-api
API for the GPT-J language model 🦜. Including a FastAPI backend and a streamlit frontend
Stars: ✭ 248 (+145.54%)
Mutual labels:  language-model, gpt-3, gpt-j
Chatbot
framework to build chatbot which could handle complex multi-turn conversation by engineering, like build website or app
Stars: ✭ 135 (+33.66%)
Mutual labels:  chatbot, chatbot-framework
Js Bot
js-bot: A powerfull chat bot based on coolq-http-api
Stars: ✭ 136 (+34.65%)
Mutual labels:  chatbot, chatbot-framework
Rasa core
Rasa Core is now part of the Rasa repo: An open source machine learning framework to automate text-and voice-based conversations
Stars: ✭ 2,302 (+2179.21%)
Mutual labels:  chatbot, chatbot-framework
Fb Botmill
A Java framework for building bots on Facebook's Messenger Platform.
Stars: ✭ 67 (-33.66%)
Mutual labels:  chatbot, chatbot-framework
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+9292.08%)
Mutual labels:  chatbot, chatbot-framework
Flottbot
A chatbot framework written in Go. All configurations are made in YAML files, or inside scripts written in your favorite language.
Stars: ✭ 175 (+73.27%)
Mutual labels:  chatbot, chatbot-framework
Chatblocks
Declarative Messenger chatbot framework
Stars: ✭ 48 (-52.48%)
Mutual labels:  chatbot, chatbot-framework
minGPT-TF
A minimal TF2 re-implementation of the OpenAI GPT training
Stars: ✭ 36 (-64.36%)
Mutual labels:  language-model, gpt3
gdc
Code for the ICLR 2021 paper "A Distributional Approach to Controlled Text Generation"
Stars: ✭ 94 (-6.93%)
Mutual labels:  language-model, gpt3
Dumbqq
对SmartQQ API的C#封装。(由于作者懒出了一定境界现已停止维护)
Stars: ✭ 60 (-40.59%)
Mutual labels:  chatbot, chatbot-framework
Botsharp
The Open Source AI Chatbot Platform Builder in 100% C# Running in .NET Core with Machine Learning algorithm.
Stars: ✭ 1,103 (+992.08%)
Mutual labels:  chatbot, chatbot-framework
Botfuel Dialog
Botfuel SDK to build highly conversational chatbots
Stars: ✭ 96 (-4.95%)
Mutual labels:  chatbot, chatbot-framework
Swiftychat
SwiftUI Chat UI (Client) Framework & Documentation to get started!
Stars: ✭ 50 (-50.5%)
Mutual labels:  chatbot, chatbot-framework
Jaicf Kotlin
Kotlin framework for conversational voice assistants and chatbots development
Stars: ✭ 160 (+58.42%)
Mutual labels:  chatbot, chatbot-framework
Program O
PHP MySQL AIML Chatbot - One click installation. Fully loaded admin area to admin your chatbot. Set up multiple chatbots. Foreign language support. XML/JSON responses or just plain HTML. Massive community of users. Twitter Plugins and lots and lots more. Please feel free to fork the DEV branch and contribute. :)
Stars: ✭ 712 (+604.95%)
Mutual labels:  chatbot, chatbot-framework
Cog
Bringing the power of the command line to chat
Stars: ✭ 910 (+800.99%)
Mutual labels:  chatbot, chatbot-framework
Rasatalk
A chatbot framework for Rasa NLU
Stars: ✭ 225 (+122.77%)
Mutual labels:  chatbot, chatbot-framework
Hutoma-Conversational-AI-Platform
Hu:toma AI is an open source stack designed to help you create compelling conversational interfaces with little effort and above industry accuracy
Stars: ✭ 35 (-65.35%)
Mutual labels:  chatbot, chatbot-framework

GPT-J

A GPT-J API to use with python

Installing gpt-j

pip install gptj

Parameters

prompt: the prompt you wish to give to the model

tokens: the number of tokens to generate (values 2048 or less are recommended)

temperature: controls the randomness of the model. higher values will be more random (suggestest to keep under 1.0 or less, something like 0.3 works)

top_p: top probability will use the most likely tokens

Advanced Parameters

user: the speaker the person who is giving gpt-j a prompt

bot: an imaginary character of your choice

context: the part of the prompt that explains what is happening in the dialog

examples: a dictionary of user intentions and how the bot should respond

Basic Usage

In the prompt enter something you want to generate

from gpt_j.Basic_api import simple_completion

prompt = "def perfect_square(num):"

The maximum length of the output response

max_length = 100

Temperature controls the creativity of the model

A low temperature means the model will take less changes when completing a prompt

A high temperature will make the model more creative

Both temperature and top probability must be a float

temperature = 0.09

top probability is an alternative way to control the randomness of the model

If you are using top probability set temperature one

If you are using temperature set top probability to one

top_probability = 1.0

Initializing the SimpleCompletion class

Here you set query equal to the desired values

Note values higher than 512 tend to take more time to generate

query = simple_completion(prompt, length=max_length, temp=temperature, top=top_probability)

Finally run the function below

print(query)

Advanced Usage

Context is a string that is a description of the conversation

from gpt_j.gptj_api import Completion

context = "This is a calculator bot that will answer basic math questions"

Examples should be a dictionary of {user query: the way the model should respond to the given query} list of examples

Queries are to the left while target responses should be to the right

Here we can see the user is asking the model math related questions

The way the model should respond if given on the right

DO NOT USE PERIODS AT THE END OF USER EXAMPLE!

examples = {
    "5 + 5": "10",
    "6 - 2": "4",
    "4 * 15": "60",
    "10 / 5": "2",
    "144 / 24": "6",
    "7 + 1": "8"}

Here you pass in the context and the examples

context_setting = Completion(context, examples)

Enter a prompt relevant to previous defined user queries

prompt = "48 / 6"

Pick a name relevant to what you are doing

Below you can change student to "Task" for example and get similar results

User = "Student"

Name your imaginary friend anything you want

Bot = "Calculator"

Max tokens is the maximum length of the output response

max_tokens = 50

Temperature controls the randomness of the model

A low temperature means the model will take less changes when completing a prompt

A high temperature will make the model more creative and produce more random outputs

A Note both temperature and top probability must be a float

temperature = 0.09

Top probability is an alternative way to control the randomness of the model

If you are using it set temperature one

If you are using temperature set top probability to one

top_probability = 1.0

Simply set all the give all the parameters

Unfilled parameters will be default values

I recommend all parameters are filled for better results

Once everything is done execute the code below

response = context_setting.completion(prompt,
              user=User,
              bot=Bot,
              max_tokens=max_tokens,
              temperature=temperature,
              top_p=top_probability)

Last but not least print the response

Please be patient depending on the given parameters it will take longer sometimes

For quick responses just use the Basic API which is a simplified version

print(response)

Note: This a very small model of 6B parameters and won't always produce accurate results

Disclaimer

I have removed the security from the API, please don't use for unethical use! I am not responsible for anything you do with the API

License and copyright

Credit

This is all possible thanks to https://github.com/vicgalle/gpt-j-api

Feel free to check out the original API

License

© Michael D Arana

licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].