• Stars
    star
    440
  • Rank 95,331 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OpenChat: Easy to use opensource chatting framework via neural networks

OpenChat: Easy to use opensource chatting framework via neural networks

   ____   ____   ______ _   __   ______ __  __ ___   ______
  / __ \ / __ \ / ____// | / /  / ____// / / //   | /_  __/
 / / / // /_/ // __/  /  |/ /  / /    / /_/ // /| |  / /   
/ /_/ // ____// /___ / /|  /  / /___ / __  // ___ | / /    
\____//_/    /_____//_/ |_/   \____//_/ /_//_/  |_|/_/     
  • OpenChat is easy to use opensource chatting framework.
  • OpenChat supports 40+ dialogue model based on neural networks.
  • You can talk with AI with only one line of code.



Installation

pip install openchat



Supported Models

  • OpenChat supports 40+ dialogue models based on neural networks.
  • Use these names as parameter model='name' when you create OpenChat.
  • Click here if you want to check supported models.

    GPT-Neo

    • gptneo.small
    • gptneo.medium
    • gptneo.large
    • gptneo.xlarge

    Blender

    • blender.small
    • blender.medium
    • blender.large
    • blender.xlarge
    • blender.xxlarge

    DialoGPT

    • dialogpt.small
    • dialogpt.medium
    • dialogpt.large

    Dodecathlon

    • dodecathlon.all_tasks_mt
    • dodecathlon.convai2
    • dodecathlon.wizard_of_wikipedia
    • dodecathlon.empathetic_dialogues
    • dodecathlon.eli5
    • dodecathlon.reddit
    • dodecathlon.twitter
    • dodecathlon.ubuntu
    • dodecathlon.image_chat
    • dodecathlon.cornell_movie
    • dodecathlon.light_dialog
    • dodecathlon.daily_dialog

    Reddit

    • reddit.xlarge
    • reddit.xxlarge

    Safety

    • safety.offensive
    • safety.sensitive

    Unlikelihood

    • unlikelihood.wizard_of_wikipedia.context_and_label
    • unlikelihood.wizard_of_wikipedia.context
    • unlikelihood.wizard_of_wikipedia.label
    • unlikelihood.convai2.context_and_label
    • unlikelihood.convai2.context
    • unlikelihood.convai2.label
    • unlikelihood.convai2.vocab.alpha.1e-0
    • unlikelihood.convai2.vocab.alpha.1e-1
    • unlikelihood.convai2.vocab.alpha.1e-2
    • unlikelihood.convai2.vocab.alpha.1e-3
    • unlikelihood.eli5.context_and_label
    • unlikelihood.eli5.context
    • unlikelihood.eli5.label

    Wizard of Wikipedia

    • wizard_of_wikipedia.end2end_generator


Usage

  • Just import and create a object. That's all.
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cpu")



  • Set param device='cuda' If you want to use GPU acceleration.
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cuda")



  • Set param device='cuda:n' If you want to use a specific GPU.
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cuda:2")  # <--- use 3rd GPU
>>> OpenChat(model="blender.medium", device="cuda:0")  # <--- use 1st GPU



  • Set **kwargs if you want to change decoding options.
    • method (str): one of ["greedy", "beam", "top_k", "nucleus"],
    • num_beams (int): size of beam search
    • top_k (int): K value for top-k sampling
    • top_p: (float): P value for nucleus sampling
    • no_repeat_ngram_size (int): beam search n-gram blocking size for removing repetition,
    • length_penalty (float): length penalty (1.0=None, UP=Longer, DOWN=Shorter)
  • Decoding options must be keyword argument not positional argument.
>>> from openchat import OpenChat
>>> OpenChat(
...    model="blender.medium", 
...    device="cpu", 
...    method="top_k",
...    top_k=20,
...    no_repeat_ngram_size=3,
...    length_penalty=0.6,                            
... )
  • For safety.offensive model, parameter method must be one of ["both", "string-match", "bert"]
>>> from openchat import OpenChat
>>> OpenChat(
...     model="safety.offensive",
...     device="cpu"
...     method="both" # ---> both, string-match, bert
... )



Special Tasks

1. GPT-Neo

  • The GPT-Neo model was released in the EleutherAI/gpt-neo repository.
  • It is a GPT2 like causal language model trained on the Pile dataset.
  • Openchat supports the above Prompt based dialogues via GPT-Neo.
  • Below models provides custom prompt setting. (* means all models)
    • gptneo.*

2. ConvAI2

  • ConvAI2 is one of the most famous conversational AI challenges about a persona.
  • Openchat provides custom persona setting like above image.
  • Below models provides custom perona setting. (* means all models)
    • blender.*
    • dodecathlon.convai2
    • unlikelihood.convai2.*


3. Wizard of Wikipedia

  • Wizard of wikipedia is one of most famous knowledge grounded dialogue dataset.
  • Openchat provides custom topic setting like above image.
  • Below models provides custom topic setting. (* means all models)
    • wizard_of_wikipedia.end2end_generator
    • dodecathlon.wizard_of_wikipedia
    • unlikelihood.wizard_of_wikipedia.*

4. Safety Agents

  • Openchat provides a dialog safety model to help you design conversation model.
  • Below models provides dialog safety features.
    • safety.offensive: offensive words classification
    • safety.sensitive: sensitive topic classification



License

Copyright 2021 Hyunwoong Ko.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

transformer

Transformer: PyTorch Implementation of "Attention Is All You Need"
Python
2,188
star
2

kochat

Opensource Korean chatbot framework
Python
443
star
3

kss

KSS: Korean String processing Suite
Python
361
star
4

pecab

Pecab: Pure python Korean morpheme analyzer based on Mecab
Python
153
star
5

kocrawl

Collection of useful Korean crawlers
Python
86
star
6

nlp-datasets

Curation note of NLP datasets
81
star
7

summarizers

Package for controllable summarization
Python
78
star
8

python-mecab-kor

Yet another python binding for mecab-ko
Python
77
star
9

kobart-transformers

Kobart model on Huggingface transformers
Python
63
star
10

asian-bart

Asian language bart models (En, Ja, Ko, Zh, ECJK)
Python
63
star
11

gpt2-tokenizer-java

Java implementation of GPT2 tokenizer.
Java
62
star
12

bert2bert-summarization

Abstractive summarization using Bert2Bert framework.
Python
31
star
13

megatron-11b

Megatron LM 11B on Huggingface Transformers
Python
27
star
14

pydatrie

Pure python implementation of DARTS (Double ARray Trie System)
Python
22
star
15

retro

An implementation of retrieval-enhanced transformer based on Hugging Face Transformers and FAISS
18
star
16

bigdata-lecture

2020 CBNU summer vacation data campus machine learning lecture materials
Jupyter Notebook
16
star
17

dialobot

Opensource chatbot framework
Python
16
star
18

beyond-lm

Beyond LM: How can language model go forward in the future?
Python
15
star
19

stop-sequencer

Implementation of stop sequencer for Huggingface Transformers
Python
15
star
20

resnext-parallel

Parallel support implementation of "aggregated residual transformations for deep neural networks" using keras
Python
10
star
21

citrus-pest-disease-recognition

Citrus pest disease recognition app based on deep learning
Java
9
star
22

instruct-tuning-example

Instruct tuning example using Hugging Face Transformers and TRL
Python
8
star
23

social-robot-bao

Artificial intelligence robot for children with autism
Java
8
star
24

still-alive

Still alive application decompiled sources
Java
5
star
25

reactive-streams

Asynchronous reactive-streams framework for java
Java
5
star
26

rx-firebase

Android mvvm template with my own implementation of rx-firebase
Java
5
star
27

low-saturation-image-classifier

Classifier whether the image has low saturation or not
Python
5
star
28

lets-kirin

Chatbot app that manage electric home devices
Java
4
star
29

brain-training

Android brain training game app for kakao
Java
4
star
30

titanic

Kaggle : predicting titanic survivors
Jupyter Notebook
4
star
31

movie-recommender

Movie recommendation system using metadata
Jupyter Notebook
4
star
32

hyunwoongko

miscellaneous
2
star
33

strabismus-recognition

Strabismus recognition module based on machine learning
HTML
2
star
34

code-pipeline

Test repository for AWS code-pipeline deployment.
Dockerfile
1
star